Why this work on terminal and not in .sh ???


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Why this work on terminal and not in .sh ???
# 1  
Old 09-01-2011
Why this work on terminal and not in .sh ???

Hi, all
I'm using that line to set dynamic window name for PuTTy session, so it displays pwd.
It's hard for me translate what this string does, especially <-ne>, could not find this anywhere in docs.
But anyway, I'm fine doing this from prompt, but I can't make this line work from the shell, tried all variation with single/double/no quotes, nothing helps. Can anybody tell me why is like this ? I'd like to put this into shell for easy setup.

Code:
bash-3. $ PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'

Tx
T
# 2  
Old 09-01-2011
Quote:
Originally Posted by trento17
It's hard for me translate what this string does, especially <-ne>, could not find this anywhere in docs.
It's two squished together, -n and -e. -n means 'do not put a newline on the end', -e means 'enable fancy escape sequences'. See man echo on your system.

Quote:
But anyway, I'm fine doing this from prompt, but I can't make this line work from the shell
What, exactly, were you doing?

Remember that setting the variable in a script does nothing. When you run ./programname it sets it in the script and nowhere else. You have to source it like . scriptname to have it run in the same shell so your shell actually gets it.
# 3  
Old 09-01-2011
Thanks,
I have a separate script that has this line + export PROMPT_COMMAND. But I didn't get pass first line yet. I expect to run this .sh in given session and get it work for this session.
I can't do this in .bashrc, .profile as I work under somebody else account. So I have a isolated prompt.sh.

Tx
T
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print Terminal Output Exactly how it Appears in the Terminal to a New Text File

Hello All, I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly. Is there any way to take the output from the cat... (7 Replies)
Discussion started by: mrm5102
7 Replies

2. Shell Programming and Scripting

Cannot get terminal application to launch with a graphical launcher when successful in terminal

I have been having an extremely annoying problem. For the record, I am relatively new at this. I've only been working with unix-based OS's for roughly two years, mostly Xubuntu and some Kali. I am pretty familiar with the BASH language, as that's the default shell for debian. Now, I've made this... (16 Replies)
Discussion started by: Huitzilopochtli
16 Replies

3. IP Networking

Discussion at work, would a router work pluging a cable in wan1 and lan1?

hi all. and sorry for the random question, but this sparkled a raging flame-war at work and i want more points of view situation a router, with linux of some sort, dhcp client requesting for ip in wan1 (as usual with wan ports) dhcp server listening in lan1, and assigning ip (as usual... (9 Replies)
Discussion started by: broli
9 Replies

4. Shell Programming and Scripting

My script doesn't work in the terminal window!

I am inexperienced with scripting and it continues to baffles me speechless I wrote a script so that it counts the number of subset of files (with different prefix) in all subdirectories under the current directory so that find ./ -type d -maxdepth 1 -mindepth 1 > list_of_dir.txtfind all... (23 Replies)
Discussion started by: piynik
23 Replies

5. UNIX for Dummies Questions & Answers

Does DOS has a terminal or pseudo terminal?

I am wondering if the DOS console works like the unix terminal? (1 Reply)
Discussion started by: vistastar
1 Replies

6. Solaris

Open Terminal Don't work

Hi, I installed solaris 10 x86 on my local system. it was working fine. today when i started the system, it started up without any problem. when i tried to open the terminal it didn't open any terminal. Plz help me (0 Replies)
Discussion started by: malikshahid85
0 Replies

7. UNIX for Dummies Questions & Answers

Gnuplot wxt terminal vs x11 terminal

Hi, I installed ubuntu recently on my pc. And I installed gnuplot as well. When I first started working with gnuplot it was working . I did a plot and when I wanted to fit my data something happened and not the default terminal of gnuplot is xwt! I changed it to: set terminal x11, but it... (0 Replies)
Discussion started by: cosmologist
0 Replies

8. UNIX for Advanced & Expert Users

Pseudo-terminal will not be allocated because stdin is not a terminal.

I am trying to automate a SSH login using Keys using the following command ssh -i id_rsa usernamw@ipaddr. I am successful in doing this and i am getting the Warning Screen and I logon successfully. but when I am executing the command tail -1cf put.dat | ssh -i id_rsa username@ipaddr > get.dat ... (1 Reply)
Discussion started by: Shivdatta
1 Replies

9. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

10. UNIX for Advanced & Expert Users

connecting to unix through hyper terminal - as a dumb terminal

I just changed from windows NT to XP and I am no longer able to connect to my unix system. I used to use hyper terminal -- which acts as dumb terminal to my main frame unix system. I think one of the options used to be "direct to comX". This option isn't listed now. I use a serial port and the... (2 Replies)
Discussion started by: michelle
2 Replies
Login or Register to Ask a Question