Sunday, January 30, 2011

BASH : Exit Status

1. cd folder
echo $? -> results is 0. This command is overriding the result 0. If you type again echo $? the results 0 is the result of the previous 'echo $?'
2. abc -> run this ommand which does not exist
echo $? -> returns 127
3. ls
echo $? -> result 0
ls-z
echo $? -> result 1
4. touch wrongcomd.sh
./wrongcmd.sh -> permision denied because don't have executable wrights
echo $? -> returns 126

No comments:

Post a Comment