Sh脚本`$?`是什么?

时间:2016-11-04 20:24:40

标签: bash sh

我想知道$?的功能?

例如,如果变量的值为VARIABLE=$?

如果当然是操作员,有办法知道这种操作员。

2 个答案:

答案 0 :(得分:0)

$#    Stores the number of command-line arguments that 
      were passed to the shell program.
$?    Stores the exit value of the last command that was 
      executed.
$0    Stores the first word of the entered command (the 
      name of the shell program).
$*    Stores all the arguments that were entered on the
      command line ($1 $2 ...).
"$@"  Stores all the arguments that were entered
      on the command line, individually quoted ("$1" "$2" ...).

答案 1 :(得分:0)

$?给你最后一个返回代码