Shell脚本---处理用户输入

命令行参数

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.

原文地址:https://www.cnblogs.com/IvySue/p/6647107.html