August 21, 2002

Bash customization for Terminal

Apple | Linux

If you're using bash as your login shell on MacOS X, you can setup Terminal windows to display the username, the machine and the pathname where of the shell is. Just add the following in your ~/.bashrc file:

case $TERM in
    vt100|xterm|cygwin*)
        TITLEBAR='\[\033]0;\u@\h: \w\007\]'
        ;;
    *)
        TITLEBAR=''
        ;;
esac

export PS1="${TITLEBAR}\u@\h:\w> "

Just make sure you disable all the "Title Displays" in the "Window" section of the preferences in Terminal.app.

This works fine also on Linux and Windows under Cygwin.

Posted by ovidiu at August 21, 2002 07:15 PM |
 
Copyright © 2002-2016 Ovidiu Predescu.