$* in bash scripting

后端 未结 8 951
一整个雨季
一整个雨季 2021-01-17 16:33

Can anybody tell me what does $* mean in bash scripting?

I tried to search on google for it, but I found only about $0, $1 an

8条回答
  •  孤街浪徒
    2021-01-17 17:18

    From the man page:

    * Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, it expands to a single word with the value of each parameter separated by the first character of the IFS special variable. That is, "$*" is equivalent to "$1c$2c...", where c is the first character of the value of the IFS variable. If IFS is unset, the parameters are separated by spaces. If IFS is null, the parameters are joined without intervening separators.

    So it is equivalent to all the positional parameters, with slightly different semantics depending on whether or not it is in quotes.

提交回复
热议问题