What is $opt variable for command line parameter in bash

前端 未结 3 988
[愿得一人]
[愿得一人] 2021-01-20 10:42

I have below bash script, I am a bit confuse about what is $opt meaning. and I do not find detail information about it after search.

test.sh:

echo

3条回答
  •  囚心锁ツ
    2021-01-20 11:03

    the for statement goes generally like this:

    for x in a b c; do
      ...
    done
    

    $x has the value a on the first iteration, then b, then c. the a b c part need not be written out literally, the list to iterate through can be given by a variable, like the $@, which has the list of all arguments to the current scope:

    for x in "$@"; do
      ...
    done
    

    further, in "$@" is assumed if you provide no list explicitly:

    for x; do
      ...
    done
    

提交回复
热议问题