特殊变量
命令 意义
$# 传递到脚本的参数列表
$? 前个命令执行情况,0成功,其它值失败
$$ 脚本运行的当前进程号
$! 运行脚本最后一个命令
$* 显示脚本全部参数
by dradhzn
1 - denotes stdout ( standard output )
2 - denotes stderr ( standard error )
/dev/null . apparently is null , nothing , empty , zero etc , etc .
2>/dev/null - redirect stderr to nothing , it turns stderr off.
>/dev/null 2>&1 also can write as 1>/dev/null 2>&1 - stdout redirect to /dev/null (no stdout) ,and redirect stderr to stdout (stderr gone as well) . end up it turns both stderr and stdout off
a little practice may help to undstand above .
#ls /usr /nothing
#ls /usr /nothing 2>/dev/null
#ls /usr /nothing >/dev/null 2>&1