4

Under what circumstances do we prefix a $ symbol to a Linux/Unix directory name?

For instance:

cd $CVBLOB
1
  • 1
    export CVBLOB=/tmp; cd $CVBLOB -> you will end up in /tmp
    – mihi
    May 19, 2011 at 16:32

1 Answer 1

6

The $ prefix means that the value is an environment variable.

For more information, see this article explaining environment variables in Linux.

4
  • So does it mean that the directory CVBLOB directly gets added to $PATH?
    – amal antony
    May 19, 2011 at 15:32
  • 2
    No, it means $CVBLOB is a variable in and of itself. Open up a terminal and type env. It'll show you a list of all the environment variables found. The $PATH variable is just one, although it's probably the most common.
    – Zach Rattner
    May 19, 2011 at 15:33
  • 2
    @user761350: No. And CVBLOLB is not a directory, it is a variable.
    – user49531
    May 19, 2011 at 15:33
  • @user761350: No. Maybe your $CVBLOB variable expands to something with, again CVBLOB in the name, like /opt/CVBLOB. But it needn't. So the answer to your original question is 'never'. A variable is prefixed with $, and the name is more or less free to chooose. And it isn't related to the path. You may extend your path with a literal name or an variable, like PATH=$PATH:$JAVA_HOME/bin or PATH=$PATH:/opt/jdk-1.6.20_26/bin` but you have to do it. There is no automatic DIR->VAR-PATH. May 19, 2011 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .