Test for a Bash variable being unset, using a function

后端 未结 7 1320
逝去的感伤
逝去的感伤 2020-12-07 11:37

A simple Bash variable test goes:

${varName:?    \"${varName} is not defined\"}

I\'d like to re-use this, by putting it in a function. How

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-07 12:09

    if set | grep -q '^VARIABLE='
    then 
        echo VARIABLE is set
    fi
    

提交回复
热议问题