Results 1 to 5 of 5

Thread: prompt problem

  1. #1
    Join Date
    Jun 2001
    Location
    netherlands/europe
    Posts
    208

    prompt problem

    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

    #!/bin/bash
    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-)

    Last edited by Lure; 08-10-2002 at 06:35 PM.

  2. #2
    Join Date
    Oct 2001
    Location
    Out West
    Posts
    3,171
    I put this in my .bashrc file.

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

  3. #3
    Join Date
    Jun 2001
    Location
    netherlands/europe
    Posts
    208

    darn

    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.

    BUT
    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.

  4. #4
    Join Date
    May 2002
    Posts
    74
    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:

    #script

    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.

  5. #5
    Join Date
    Jun 2001
    Location
    netherlands/europe
    Posts
    208

    SAVED!

    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

    Last edited by Lure; 08-11-2002 at 11:09 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •