How can I get the error code (exit code) of “xdg-mime query filetype” command?-Collection of common programming errors
In Bourne-derived shells (sh
, ash
, bash
, dash
, zsh
…) the exit code of the last-run program is in the $?
variable:
$ ls /no-such-file
ls: /no-such-file: No such file or directory
$ echo $?
2
So in this case, the exit code of ls
is 2.
Originally posted 2013-11-09 23:11:31.