Created
February 11, 2010 12:26
-
-
Save pwood/301467 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stick this at the end of your .bashrc. | |
changetitle () { | |
if (( $# != 0 )); then | |
#echo -ne "\e]0;$* \a" | |
echo -ne "\033]0;$*\007" | |
fi | |
} | |
command_title () { | |
# New New sed way, easier on the eye, easier on the CPU | |
# newtitle=$(echo $(history 1) | sed -r -e 's/^[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+ //' | head -n 20) | |
newtitle=$(echo $(history 1) | sed -r -e 's/^[[:space:]]*[[:digit:]]*[[:space:]]*//') | |
if [ ! -z "$newtitle" ]; then | |
changetitle $newtitle | |
fi | |
# if [ -z "$newtitle" ]; then | |
# changetitle $LOGNAME@$HOSTNAME:$PWD | |
# else | |
# changetitle $newtitle | |
# fi | |
} | |
if [[ -z $(trap -p DEBUG) ]]; then | |
trap command_title DEBUG | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment