Environmental issues (part 1)

ript>

As a developer, I prefer working with command line utilities. That’s why I have devoted my first workspace area to an almost full-screen sized terminal window (I prefer gnome-terminal, although I’m working with KDE and konsole is just as good to work with) comprising of 3 or more tabs.

I want the first tab to always open mutt (the e-mail client that does almost everything), the second one to change to my most recent project’s directory (where I can edit the source files with vim — tabbed, using “vim -p”) and make a backup of the project’s database, the third to check some log-file, and the list goes on.

So, what’s the best way to automate these procedures?

Currently I’m using the output of the “tty” command and a case statement at the end of my ~/.bashrc file (comments included):


# show me from where I logged in
echo Logged in from $(tty)
case "$(tty)" in
"/dev/pts/1")
# run mutt
mutt
;;
"/dev/pts/2")
# first change directory
cd ~/projects/projectName
# then perform a quick database backup
make back
;;
"/dev/pts/3")
# show me web visits, ignoring some of them based on certain criteria
tail -f /var/log/apache2/access.log | egrep -v "localhost|127.0.0|/(Thumb|images|Photo)/|favicon"
;;
esac

With arrangements like the above, one can “feel like home” by just logging in!


Visit The Light of the LAMP blog for more…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.