❑ Exit status : The returned value when a program exits. This can only be used if the program supports exit status.
❑ "$?" has the exit status.
* 0 : Successfully executed.
* 1~255(Non-zero) : An error occurred.
In above image, the "vi" program doesn't support the exit status. It always has the 0 exit status.
On the other hand, the "ls" program support the exit status. the below image is the manual of the "ls" program. the exit status can be checked.