首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

shell内置的非一般变量

2012-07-24 
shell内置的特殊变量$0 :被执行shell文件的路径[username@hostname]# ./test.sh?? 则$0 ./test.sh??$

shell内置的特殊变量

$0 :被执行shell文件的路径

[username@hostname]# ./test.sh?? 则$0 == './test.sh'

?

?

$1 , $2, $3 ...., 传递给shell文件的各个参数

[username@hostname]# ./test.sh a b c

则$1=='a', $2=='b', $3=='c'

?

?

$# 传递给shell文件的参数个数

./test.sh a b c

则$#==3, 可在shell脚本中使用[ $# -gt 0 ] 测试是否传递了参数

热点排行