2016-11-04 102 views
-4

我想知道$?的功能吗?

例如,如果一个变量有这个值一样VARIABLE=$?

有办法知道这种运营商,如果是当然的运营商。

+1

最后一条命令返回码。 –

+0

[bash munual](https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters) – F4240

+0

您的问题在'$'或'$?'上?因为标题不适合抽象编辑 – F4240

回答

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 ...). 
"[email protected]" Stores all the arguments that were entered 
     on the command line, individually quoted ("$1" "$2" ...). 
+1

如果你要从另一个SE的c/p,那么至少链接源:http://superuser.com/a/247131/508800 – andlrc

0

$?给你最后一个返回码