Print the IP of the machine at login

Wanted to know the IP address of the test machine the moment I log in. include the following in your .bashrc file.

echo "Welcome to" `hostname` "("`ifconfig eth0 | grep "inet addr:" | awk -F: '{print($2)}' | sed "s/ /:/g" | awk -F: '{print($1)}' `")"

Not very efficient use of sed and awk :(

No comments: