2
2
Is it possible to create a symlink to a directory, like /var/lib/tomcat6/webapps/MyWar that I can access from everywhere? I want to be able to say cd myapp
from anywhere in the directory tree and go to that directory. Is it only possible in the directory where I create the symlink?
Do I have to update my ~/.bashrc file to include an alias like: alias myapp="cd /var/lib/tomcat6/webapps/MyWar"
and then just type myapp
from anywhere? What is the best way to handle this situation so I don't always have to type in the long directory? I also want to be able to use that parameter in say a copy command, so the alias wouldn't help in that situation. Hopefully I can do something similar where ~ maps to the home directory in any command.
+1 Setting the environment variable is the standard way to so this. Adding export MYWAR="/var/lib/tomcat6/webapps/MyWar" to your .bashrc file will allow you to do cd $MYWAR from anywhere. – Richard Holloway – 2010-03-16T06:50:54.457