命令行参数

1,读取参数

  $0  程序名

  $1  第一个参数

  $2  第二个参数

  ...

  直到

  $9  第九个参数

2,特殊参数变量

  $# 命令行参数的个数

  $* 将命令行上提供的所有参数当作单个单词保存

  $@ 将命令行上提供的所有参数当作多个独立的单词,可以用for遍历

  $? is used to find the return value of the last executed command

  $$ is the process ID (PID) of the script itself.

posted on 2017-03-30 17:06  coder为  阅读(211)  评论(0编辑  收藏  举报