Browse Source

Update 09_Zsh-开发指南(第九篇-函数和脚本).md

Gore Liu 6 years ago
parent
commit
54f25b5cb8
1 changed files with 5 additions and 1 deletions
  1. 5 1
      09_Zsh-开发指南(第九篇-函数和脚本).md

+ 5 - 1
09_Zsh-开发指南(第九篇-函数和脚本).md

@@ -277,6 +277,10 @@ while {getopts i:t:cv arg} {
 
 # $OPTIND 指向剩下的第一个未处理的参数
 echo $*[$OPTIND,-1]
+
+# 或者用 shift 把之前用过的参数移走
+# shift $((OPTIND - 1))
+# echo $*
 ```
 
 运行结果:
@@ -338,4 +342,4 @@ https://my.oschina.net/lenglingx/blog/410565
 
 20170901:增加用 $? 获取函数返回值的内容。
 
-20170902:增加“用 getopts 命令处理命令行选项”。
+20170902:增加“用 getopts 命令处理命令行选项”。