Dynamic name Putty (with $ PWD)

I want the spatula to display the current folder. Is it possible?

For example, when I'm in $HOME, a putty window title will be $HOME.

Then, if I do cd $HOME/foodir, the title will change to $HOME/foodir.

Is it possible?

thanks

+4
source share
2 answers

PS1 setup didn't work for me (putty 0.62).

I am using bash and here is what works:

PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
+5
source

A Putty window looks like a terminal on Linux, so its behavior is similar to a window in x mode on Linux, for example ...

U PS1 , , : http://www.networkinghowtos.com/howto/how-to-set-the-putty-window-title-via-script/

PS1 /home/user/.bash_profile:

PS1="\[\e]2;\u@\H\w\a\[\e[32;1m\]>\[\e[0m\]"

, U .

...

+2

All Articles