View Full Version : prompt problem

08-10-2002, 06:33 PM
my books, websearch and threads... can't find an answer

when I type PS1="\w\\$ " behind the bash I get a perfect new bash that shows the current dir.

When I try to do this from a script like

PS1="\w\\$ " && echo prompt altered || echo prompt not altered

I get a msg saying [prompt altered] but that is not true. I still have my old bash prompt.

I have read and read about / "and ' untill I fell a sleep and now before I go to bed I turn to one of you to help me.
Where do I mess up? nevermind the msgs I try to output....I want that prompt to obey my will-)

:D :D :D

08-10-2002, 08:48 PM
I put this in my .bashrc file.

PS1="\s-\v[\w]$ "

08-11-2002, 12:54 AM
Bubblelamp wrote:
I put this in my .bashrc file.
PS1="\s-\v[\w]$ "

Thx in the first place: it's a nice prompt-) think I'm gonna use it.

my problem stays the same. when I type this command behind the bash prompt it changes to you beautyfull bash-v[/var/temp] but when I put it in a script it doesn't do a thing. no error msg, no changing bash...

I think my question is more a question on how to run a command from a script then then anything else. Hope someone has an answer, in the meantime i'm back to the books. hopefully my 5 hours of sleep will clear up my vision.

08-11-2002, 10:09 AM
the general rule with shells is that when you run a shell script, it will be run in a newly spawned shell. In other words, what's happening is when you do:


what's happening is that a new bash process is being created to run your script. the prompt of _that_ process _is_ changed as you request.

this isnt true for .bashrc, of course.

the way to tell your shell to _not_ launch a new shell for a script, and to run it in the current process is to precede the script name with a ". " - thats dot-space. This is in general; I've not tested on the tivo yet, but id be extremely surprised if this is different.

08-11-2002, 11:06 AM
angra said
I've not tested on the tivo yet, but id be extremely surprised if this is different.
you ars SO right and im SO happy. problem solved!
THANK YOU; ANGRA and bubblelamp too

:D :D :D