$?
–
Exit Status
$? is the decimal exit status of the most recent command executed.
Following the execution of a pipe, $? gives the exit status of the last command executed.
Following the execution of a function, $? gives the exit status the last command executed in the function.
The return builtin command allows to define the exit status of a function.
Links
Examples
- Return from function with exit status 2 and print status
- Output:
1 2 3a() { return 2; } a echo $?12
BashSupport Pro 是一款 Bash 和 POSIX 集成开发环境,支持 $? - 立即试用!