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

posted on 2014-10-09 17:43  懒懒的呐喊  阅读(155)  评论(0编辑  收藏  举报