Renaming putty windows with a shell script

i frequently have to open multiple putty windows to ssh into a unix server running HP-UX 11.23. Since i use some of the windows for dedicated processes i would like to rename them (the caption displayed in the titlebar) to something more convenient than the standard <Host>.<Server>.com

While researching on how to do this, I came across this site: http://www.mail-archive.com/screen-users@g...g/msg00331.html

This works fine when I run the command from the command line, but I wanted to make a shell script so that I can just say something like 'settitle.sh This is window 1' and it would rename that particular window to "This is window 1"

I made the following script (settitle.sh) for this:

#!/bin/sh

params=$*
PROMPT_COMMAND='echo -ne "\033]0; $params \007"'

I created an alias to this script in my profile:

alias title='. $SCRIPTS/settitle.sh'

Now this is what I dont understand:
If i say

title This is window 1

the title of my window gets set accordingly

However if I say

./settitle.sh This is window 2

nothing happens :confused:

If i try calling the settitle.sh script through another script, its the same thing: nothing happens....

Now I've just started off scripting a few weeks ago so I'm not an expert or anything but this has got me stumped...

Anyone got any ideas?

The second one is running the script in a child process. Try from the directory that the settile.sh script is in:

. ./settitle.sh This is window 2

brilliant :slight_smile:

i should have read the Bash basics before starting off :stuck_out_tongue:

Thanks!

Could you please post your script settitle.sh?

The original link is no longer accessible, and I am having the same issue with SSH.

Thanks a lot in advance,

its up there in my first post, as well as here below now :slight_smile:

#!/bin/sh

params=$*
PROMPT_COMMAND='echo -ne "\033]0; $params \007"'

have fun!