This one has been annoying me for quite a while - looking at the string of tabs in the mac's Terminal App, all of them titled "bash" except for the one trying to download webkit which is usefully titled "git".
So I finally decided to do something about it, namely google the solution. Here're the results:
As a bonus, the cd() function adds the ability to change the title to whatever directory you currently are on - which works just fine when you're in your projects directory :)
I think this should work on Linux as well; confirmation TBD.
So I finally decided to do something about it, namely google the solution. Here're the results:
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
# add these to your .bash_profile | |
# title sets your terminal tab's title to any string you pass in. | |
# from http://stackoverflow.com/a/1687708 | |
function title() { echo -n -e "\033]0;$@\007";} | |
# cd modifies the cd command and uses title to set it to whatever the current dir is. | |
# from http://superuser.com/a/296555 | |
function cd() { builtin cd "$@" && title ${PWD##*/}; } | |
# Confirmation that title() works on a mac came from a book called "Mac OSX for Unix Geeks" on Google books. |
I think this should work on Linux as well; confirmation TBD.
No comments:
Post a Comment