Sunday, October 7, 2012

A BASH prompt that displays running command on Xterm title

In order to have a quite explanatory bash prompt showing current directory and time, and an Xterm title that shows the currently running command or the current directory when idle, use this:

    PS1='\e]0;\W\007\n\[\e[0;35m\]\u@\h: \[\e[1;36m\]\w/\n\[\e[1;33m\]\t $ \[\e[0m\]'
    trap 'echo -ne "\e]0;$BASH_COMMAND\007"' DEBUG
    set +o functrace # Do not inherit traps, to prevent messing with completion 

No comments:

Post a Comment