位置变量 position variable$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
一个简单的脚本程序
- #!/bin/bash
-
-
echo $0
-
echo $1
-
echo $2
-
echo $3
-
echo $4
-
echo $5
-
echo $6
-
echo $7
-
echo $8
-
echo $9
显示效果
- ywx@yuweixian:~/yu/course/hello$ ./test a b c d e f g h i
- $0 $1
- ./test
-
a
-
b
-
c
-
d
-
e
-
f
-
g
-
h
-
i
通过set 命令来设置 $ 变量
- ywx@yuweixian:~/yu/course/hello$ set a b c d e f g h i
-
ywx@yuweixian:~/yu/course/hello$ echo $0 $1 $2
-
bash a b
-
ywx@yuweixian:~/yu/course/hello$
阅读(967) | 评论(0) | 转发(0) |