"对于I"无"在[序列] QUOT;同时使用getopt的结束 [英] "for i" without "in [sequence]" ending while using getopt
本文介绍了"对于I"无"在[序列] QUOT;同时使用getopt的结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现示例脚本中使用的shell命令的getopt
I've found example script for using getopt command in shell.
#!/bin/bash
args=$(getopt ab $*)
set -- $args
for i;
do
case "$i" in
-a)shift; echo "it was a";;
-b)shift; echo "it was b";;
esac;
done
这工作得很好,但我不明白的地方是变量$我分配。它是如何知道它必须通过$ ARG迭代。你能解释一下吗?
It work well, but I don't understand where is variable $i assigned. How it knows that it must iterate through $arg. Can you explain this?
推荐答案
如图所示这里,为
默认为 $ @
如果没有在SEQ
中给出。在对我
指定您的 $ I
变量。
As shown here, for
defaults to $@
if no in seq
is given. The for i
assigns your $i
variable.
这篇关于"对于I"无"在[序列] QUOT;同时使用getopt的结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文