I am using CentOS 5.4. I created a bash script that does some checking before running any commands. If the check fails, it will simply
exit 0. The problem I am having is that on our server, the script will exit the
ssh session when the
exit 0 is called.
#!/bin/bash # check if directory has contents and exit if none if [ -z "`ls /ebs_raid/import/*.txt 2>/dev/null`" ]; then echo "ok" exit 0 fi
here is the output:
[root@ip-10-251-86-31 ebs_raid]# . test.sh ok [russ@ip-10-251-86-31 ebs_raid]$
as you can see, I was removed from my sudo session, if I wasn't in the sudo session, it would have logged me out of my ssh session. I am not sure what I am doing wrong here or where to start.