shell args
Posted 良红
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell args 相关的知识,希望对你有一定的参考价值。
$ cat test.sh
#!/bin/bash
echo "shell args option"
echo "script name : $0"
echo "first args : $1"
echo "first args : $2"
echo "first args : $3"
echo "------- $# demonstration"
echo "args number: $#"
echo "------- $$ demonstration"
echo "shell pid: $$"
echo "------- $* demonstration"
for i in "$*";do
echo $i
done
echo "------- [email protected] demonstration"
for i in "[email protected]";do
echo $i
done
echo "------- $- demonstration"
echo $-
$ ./test.sh 1 2 3
shell args option
script name : ./test.sh
first args : 1
first args : 2
first args : 3
------- $# demonstration
args number: 3
------- $$ demonstration
shell pid: 12263
------- $* demonstration
1 2 3
------- [email protected] demonstration
1
2
3
------- $- demonstration
hB
[email protected]:~/shell$ echo $?
0
以上是关于shell args 的主要内容,如果未能解决你的问题,请参考以下文章