What is the difference between using an environment variable, like PATH, as $PATH or ${PATH}?
What is the difference between using an environment variable, like PATH, as $PATH or
Share
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.
There’s no difference in most cases. The only times it matters is if you want to include trailing text after the expansion. For example, suppose your
PATHcontained the stringFOO(not actually a valid path, but this is for an example), and you wanted to form the stringFOOBAR. If you didYou would get the expansion of the variable named
PATHBAR, which is probably not what you wanted. If you didYou would get a space between
FOOandBAR, also not what you wanted. The solution is to use braces:This gives you
FOOBAR.