Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我遇到了$?在我进行集成的其中一个 shell 脚本中(不是我编写的)。
只是想确认它是指上一个命令的返回码。
用法类似于
runSomeCommand $VAR1 $VAR2 $VAR3 processResult $?
$?是最后执行的命令的退出状态。
$?
ls .... echo $? 0 $ ls notexistingfile ls: cannot access notexistingfile: No such file or directory echo $? 2