LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash - what does if [ ${?} -ne 0 ] mean? (https://www.linuxquestions.org/questions/linux-newbie-8/bash-what-does-if-%5B-%24%7B-%7D-ne-0-%5D-mean-363232/)

davee 09-14-2005 05:54 AM

Bash - what does if [ ${?} -ne 0 ] mean?
 
More specifically, what does the ${?} bit mean...?

Dave

theYinYeti 09-14-2005 06:13 AM

Here, ${?} is strictly equivalent to $?, which means the return value of the last executed command.

See "man bash".

Yves.

blindcoder 09-14-2005 06:58 AM

@Yeti: it is nearly impossible to search for that in the bash man page, please forgive that user for being unable to do the impossible :P

@davee: as yeti mentioned, it's the return value of the last process executed. Usually a process returns 0 on success and a non-zero value on error so this code snippet is for checking if the last executed process was being run successfully.

davee 09-14-2005 06:58 AM

Cheers...! It's not the easiest thig to search for in google.

Dave

freakyg 09-14-2005 07:57 AM

Quote:

Originally posted by davee
Cheers...! It's not the easiest thig to search for in google.

Dave

huh, why use google when LQ has a "man page" page............

http://man.linuxquestions.org/


All times are GMT -5. The time now is 04:16 AM.