system variables question

Discussion in 'macOS' started by Nick T., Jan 5, 2008.

  1. Nick T. macrumors regular

    Joined:
    Oct 4, 2006
    Location:
    SoCal
    #1
    In the process of teaching myself how to use terminal I found something that probably makes no difference at all, but has aroused my curiosity. Here’s the setup:

    Entering echo “$PS1” shows \h:\W \u\$
    This is what I expect since there is no .profile or .bash_profile or other start-up file in my home directory.

    If I make any change to the command prompt, even duplicating the existing prompt - - for example:
    export PS1=“\h:\w \u\$ “ changes the prompt, but entering echo “$PS1” now gives \h:\w \u$

    What happened to the backslash between the u and the $?

    Am I using bad methodology to change the contents of PS1?

    It’s a clean install 10.5.1 on an Intel Mac-mini.

    Please keep your response pretty simple. I’ve been playing with OS X for less than a year, and trying to learn the Unix side for about a month. My knowledge layer is pretty thin - - but chasing down interesting trivialities seems a good way to learn Unix.

    thanks,
    - Nick T.
     
  2. ScoobyMcDoo macrumors 65816

    Joined:
    Nov 26, 2007
    Location:
    Austin, TX
    #2
    I'm not sure exactly what's going on there, but you got me curious for a minute. One thing I did notice is that if you type

    PS1="\h:\w \u\\\$ "

    you will see what you saw before in the echo, however it doesn't seem to affect the actual displayed prompt.

    Oh well outta time for this stuff.
     
  3. Nick T. thread starter macrumors regular

    Joined:
    Oct 4, 2006
    Location:
    SoCal
    #3
    very interesting
     

Share This Page