commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
You can set the previous bash command as the terminal title by this command.
-trap assigns a command to execute at a given bash signal.
-in the $BASH_COMMAND you find the last command
-you can set the terminal title with the escape sequence: \e]0;this is the title\007
-to let the echo care about the backslashes give the -e to it
Since trap is a built in bash command you find more informatin in 'man bash'for more
There is 1 alternative - vote for the best!
Found the same command for zsh in http://www.davidpashley.com/articles/xterm-titles-with-bash.html - changed it a bit so that the behaviour is the same
Found another way, more compatible. Tested with xterm, aterm, gnome-terminal and rxvt (where it sets the window title) and guake (where it doesn't - after all, guake does not show the window title).
If you can do better, submit your command here.
You must be signed in to comment.