getopts介绍:
(1)getopts 是 Shell 内建命令,getopt 是一个独立外部工具
(2)getopts 使用语法简单,getopt 使用语法较复杂
(3)getopts 不支持长参数(如:–option ),getopt 支持
(4)getopts 不会重排所有参数的顺序,getopt 会重排参数顺序(这里的区别下面会说明)
(5)getopts 出现的目的是为了代替 getopt 较快捷的执行参数分析工作
getopts用法:
getopt -q hadms:p: $@
有参数后面加冒号
没参数不用加
详细介绍:
https://www.cnblogs.com/yxzfscg/p/5338775.html