Visit Our UNIX and Linux User Community


Renaming putty windows with a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Renaming putty windows with a shell script
# 1  
Old 10-23-2006
Bug 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-u.../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:

Code:
#!/bin/sh

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

I created an alias to this script in my profile:

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

Now this is what I dont understand:
If i say
Code:
title This is window 1

the title of my window gets set accordingly

However if I say
Code:
./settitle.sh This is window 2

nothing happens Smilie

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?

Last edited by orno; 10-23-2006 at 11:02 AM..
# 2  
Old 10-23-2006
Quote:
alias title='. $SCRIPTS/settitle.sh'

./settitle.sh This is window 2
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
# 3  
Old 10-23-2006
brilliant Smilie

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

Thanks!
# 4  
Old 11-25-2008
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,
# 5  
Old 11-25-2008
its up there in my first post, as well as here below now Smilie

Code:
#!/bin/sh

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

have fun!

Previous Thread | Next Thread
Test Your Knowledge in Computers #842
Difficulty: Medium
HTTP server push (also known as HTTP streaming) is a mechanism for sending unsolicited (asynchronous) data from a web server to a web browser.
True or False?

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Method to run a shell script using shortcut key in keyboard with out logging to putty

Dear All, I want to run a shell script with out logging to putty but configuring it to a keyboard short cut it windows PC. Can this be done? I want this to rename a log in a specified folder in a system Thanks (8 Replies)
Discussion started by: Chi_SL
8 Replies

2. UNIX for Dummies Questions & Answers

startX windows application during boot.....putty connection takes the windows

Dear all i am new to linux/debian i run my application on the computer...during startup in bashrc i wrk wid dis script to invoke startx..i do this above command and it works perfectly... if && ; then startx -- -br 1>/dev/null exit 0 fi i use winscp for file transfer and putty for... (1 Reply)
Discussion started by: venkat_330
1 Replies

3. Shell Programming and Scripting

Exits from putty instead of shell script

Dear, I have written below code to initiate the log at top of my script. #Set the log file LOGFILE=<path>/<filename.log> exec > $LOGFILE 2>&1 ............... .... ... .. ............ echo -e "\n\n Script finished OK " `date "+%m/%d/%y %H:%M:%S" ` "\n\n" exit 0 the logging ends only... (14 Replies)
Discussion started by: Imran_Chennai
14 Replies

4. Shell Programming and Scripting

renaming directories with shell script

Hi All after looking around the website and various other resources I become stuck. I'm trying to rename directories from Firstname Initial Lastname to lastname,_firstname_initial so far ive got for f in {./} do rename -n 'y/A-Z/a-z/' * rename -n 's/\ /_/g' * ... (2 Replies)
Discussion started by: harlequin
2 Replies

5. Shell Programming and Scripting

Renaming multiple files with a shell script

Hey guys, I'm really new to UNIX and shell scripting in general. For my internship I need to rename a bunch of files. Specifically, I need to change the first letter of each of the files to lowercase and I have to change the endings so they all basically look like "file_cone.jpg". I know I... (4 Replies)
Discussion started by: jjzieve
4 Replies

6. UNIX for Dummies Questions & Answers

Renaming Files using Shell Script

Hi Gurus, I have some files(all ending with .out as extension). Ex: aa1.out aa2.out aa3.out I would like to append each file with the current date to the end of the file so that they should become aa1_20090504.out. So I am using rename as follows: for i in path/aa* ; do mv $i... (5 Replies)
Discussion started by: asmfloyd
5 Replies

7. Shell Programming and Scripting

Renaming file names in a shell script

I want to write a shell script that will rename all the file names to today's date attached to it.. so for example i have a file names like file1.sales.20081201.txt.c zbrs.salestxtn.20091101.txt.inn then it will rename both the files with todays date to it so the file names get changed... (1 Reply)
Discussion started by: rudoraj
1 Replies

8. UNIX for Advanced & Expert Users

Use putty problems in windows

Hello all, I have encountered a strange question. I installed a Ubuntu 8.10 in the VMware in the XP, and use putty to connect to ubuntu. Everything is fun except I can't use the wget in putty, neither does command "sudo apt-get ***". But they are OK in the VM. Can someone help me out? Thank... (2 Replies)
Discussion started by: tpltp
2 Replies

9. Shell Programming and Scripting

Putty Input thru Windows

Hi anyone knows how to pass values to putty command prompt from MS windows. since i am have a shell script to get input of several lines. i dont want to type it rather than input values from some windows based application is there any way thanks in advance. (2 Replies)
Discussion started by: JACKDSOUZA
2 Replies

10. Shell Programming and Scripting

copying files and Renaming them + shell script

Hi, I have a problem. I have some text files in a folder. The names can be like: emp.txt emp1.txt emp3.txt 32emp4.txt What i need is i have to copy all the files which have "emp" string in their filename to a different folder and those file names... (7 Replies)
Discussion started by: pathanjalireddy
7 Replies

Featured Tech Videos