The string '\[\e]2;\H:$PWD\a\]' in PS1 will show the hostname and path in the title bar. The single quotes are important. Also, enclosing the string with \[..\] also matters when it comes to screen wrap. It tells the wrapping mechanism to not count the enclosed characters.
If you use double quotes, use \w instead of $PWD. I like $PWD because it shows the full path and not '~' if the current dir is the home dir.
Another way to do this is in bash is by placing the string in PROMPT_COMMAND. Don't use this unless echo is a shell builtin.
No comments:
Post a Comment