Linux Batch
$0 is the name of the script itself, $1 is the first argument, $2 the second, $3 the third, and so forth.
[27] After $9, the arguments must be enclosed in brackets, for example, ${10}, ${11}, ${12}.
The special variables $* and $@ denote all the positional parameters.
The shift command reassigns the positional parameters, in effect shifting them to the left one notch.
$1 <--- $2, $2 <--- $3, $3 <--- $4, etc.
表 1. 一些常见的文件测试
操作符 | 特征 |
---|---|
-d | directory |
-e | existing(same as -a) |
-f | file |
-h | link sympol(也可以用 -L) |
-p | pipe |
-r | is readable |
-s | not null |
-S | socket |
-w | writable |
-N | is modified since last read |
- 上一篇 »linux文件系统目录解析
- 下一篇 »linux--软件包管理工具