What is indirect expansion? What does ${!var*} mean?

前端 未结 5 1616
野趣味
野趣味 2020-11-22 05:28

I\'m reading \"Bash Guide for Beginners\". It says:

If the first character of PARAMETER is an exclamation point, Bash uses the

5条回答
  •  生来不讨喜
    2020-11-22 06:19

    Yes, it searches for all possible expansions of variables after the !. If you had done:

    echo ${!NP*}
    

    you would get only NPX_PLUGIN_PATH.

    Consider the following example:

    :~> export myVar="hi"
    :~> echo ${!my*}
        myVar
    :~> export ${!my*}="bye"
    :~> echo $myVar
        bye
    

提交回复
热议问题