What is the meaning of a bash variable used like this:
${Server?}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It works almost the same as (from the
bashmanpage):That particular variant checks to ensure the variable exists (is both defined and not null). If so, it uses it. If not, it outputs the error message specified by
word(or a suitable one if there is noword) and terminates the script.The actual difference between that and the non-colon version can be found in the
bashmanpage above the section quoted:In other words, the section above can be modified to read (basically taking out the “null” bits):
The difference is illustrated thus:
There, you can see that while both unset and null variable result in an error with
:?, only the unset one errors with?.