Wednesday, August 16, 2006

Bash : Saving time with Environment Variables

You can create an environment variable $dr (for document_root) to save typing the whole path /var/www/html.

In your .bashrc file add this line

export dr=/var/www/html

Then source .bashrc. After this you'll be able to use shortcuts like

vi $dr/index.htm

With export, we create a new environment variable. In c shell, the syntax is

setenv dr /var/www/html

You can see all the environment variables with env.

No comments: