我运行xdg-mime query filetype<file name> 来检查文件的 MIME 类型,但它失败了。如何打印命令的错误代码(退出代码)xdg-mime?
我想知道发生了什么错误:
在 Bourne 派生的 shell ( sh, ash, bash, dash, zsh...) 中,最后运行的程序的退出代码在$?变量中:
$ ls /no-such-file
ls: /no-such-file: No such file or directory
$ echo $?
2
Run Code Online (Sandbox Code Playgroud)
所以在这种情况下,退出代码ls是 2。