Directory Shortcuts Using Bash Functions

by damonp on June 15, 2006

in Linux

Modify this snippet to match the directory shortcuts you need on your system and add into your .bashrc file:

www () {
if [ $1 == "domain1" ]; then
    cd /www/vhosts/domain1.com/htdocs
elif [ $1 == "domain2" ]; then
    cd /www/vhosts/domain2.com/htdocs      
else
    cd /www/vhosts/$1 ;
fi
echo `pwd`;
}

To use:

www domain1

Popularity: 1%

Most Popular Posts

Damon Parker is a freelance sysadmin and web developer in Texas. He specializes in server setup, server security and high performance server configurations. Need help setting up a web server or getting a server back online after a crash or hack? Email Damon

Leave a Comment

Previous post:

Next post: