码迷,mamicode.com
首页 > 其他好文 > 详细

shell变量

时间:2014-10-09 20:34:07      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:io   ar   sp   on   bs   as   shell   ash   ld   

#!/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变量

标签:io   ar   sp   on   bs   as   shell   ash   ld   

原文地址:http://www.cnblogs.com/jjj250/p/4013925.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!