首页 > 代码库 > shell变量
shell变量
#!/bin/sh
echo -e “\$#(number of parameters):” $#
echo -e “\$0(program name):” $0
echo -e “\$1(first parameter):” $1
echo -e “\$2(second parameter):” $2
echo -e “\$@(all parameters):” “$@”
echo -e “\$*(show parameters):” $*
echo -e “\$\$(pid of this program):” $$
echo -e “\$?(show exit stat of previous program):” $?
shell>chmod u+x /tmp/test.sh
shell>/tmp/test.sh p1 -p2 –p3
$#(number of parameters):3
$0(program name):/tmp/test.sh
$1(first parameter):p1
$2(second parameter):-p2
$@(all parameters):p1 -p2 –p3
$*(show parameters):p1 -p2 –p3
$$(pid of this program):24063
$?(show exit stat of previous program):0
shell变量
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。