xterm not getting PS1 from .bash_profile - Help

This is a discussion on xterm not getting PS1 from .bash_profile - Help ; Running Fedora Core 1, my .bash_profile consists solely of the following line: PS1='\u@\h:\w$ ' When I log into the console it's fine, and I get jzilla@localhost:~$ but when I start an xterm, it's a default bash-2.05b$ Why the disparity? I've ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: xterm not getting PS1 from .bash_profile

  1. xterm not getting PS1 from .bash_profile

    Running Fedora Core 1, my .bash_profile consists solely of the following
    line:

    PS1='\u@\h:\w$ '

    When I log into the console it's fine, and I get

    jzilla@localhost:~$

    but when I start an xterm, it's a default

    bash-2.05b$

    Why the disparity? I've had the problem due to permissioning in the past
    (/home is mounted via NFS), so I recreated .bash_profile, but that
    didn't help.

    Anything else I can try?

  2. Re: xterm not getting PS1 from .bash_profile

    jzilla wrote:
    > Running Fedora Core 1, my .bash_profile consists solely of the following
    > line:
    >
    > PS1='\u@\h:\w$ '
    >
    > When I log into the console it's fine, and I get
    >
    > jzilla@localhost:~$
    >
    > but when I start an xterm, it's a default
    >
    > bash-2.05b$


    Have a look in ~/.bashrc

    --
    Cameron Kerr
    cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/
    Empowered by Perl!

  3. Re: xterm not getting PS1 from .bash_profile

    On 22:57 31 Jan 2004, jzilla wrote:
    | Running Fedora Core 1, my .bash_profile consists solely of the following
    | line:
    |
    | PS1='\u@\h:\w$ '
    |
    | When I log into the console it's fine, and I get
    |
    | jzilla@localhost:~$
    |
    | but when I start an xterm, it's a default
    |
    | bash-2.05b$
    |
    | Why the disparity? I've had the problem due to permissioning in the past
    | (/home is mounted via NFS), so I recreated .bash_profile, but that
    | didn't help.

    New terminals aren't login shells. You want your .bashrc instead.
    However, presuming this is under a GUI login, if you just source your
    ..bash_profile during the X11 startup and make sure you export $PS1 it
    _ought_ to work as on the console, avoiding the need to have a .bashrc
    (for this purpose, anyway).

    Cheers,
    --
    Cameron Simpson DoD#743
    http://www.cskk.ezoshosting.com/cs/

    Stupidity is the only universal capital crime. The sentence is death, and it
    is carried out automatically and without appeal. - Lazarus Long

  4. Re: xterm not getting PS1 from .bash_profile

    Cameron Simpson wrote:
    > On 22:57 31 Jan 2004, jzilla wrote:
    > | Running Fedora Core 1, my .bash_profile consists solely of the following
    > | line:
    > |
    > | PS1='\u@\h:\w$ '
    > |
    > | When I log into the console it's fine, and I get
    > |
    > | jzilla@localhost:~$
    > |
    > | but when I start an xterm, it's a default
    > |
    > | bash-2.05b$
    > |
    > | Why the disparity? I've had the problem due to permissioning in the past
    > | (/home is mounted via NFS), so I recreated .bash_profile, but that
    > | didn't help.
    >
    > New terminals aren't login shells.


    Ah, that makes sense.

    > You want your .bashrc instead.
    > However, presuming this is under a GUI login, if you just source your
    > .bash_profile during the X11 startup and make sure you export $PS1 it
    > _ought_ to work as on the console, avoiding the need to have a .bashrc
    > (for this purpose, anyway).


    Putting PS1 in .bashrc sorted out xterm, thanks. Could you expand on
    'source your .bash_profile'?
    On the off chance, I added '~/.bash_profile' to .xinitrc, but it says
    '/home/jzilla/.xinitrc: line 2: /home/jzilla/.bash_profile: Permission
    denied'. It's permission 644 and I'm the owner.

  5. Re: xterm not getting PS1 from .bash_profile

    On 15:47 01 Feb 2004, jzilla wrote:
    | >New terminals aren't login shells.
    | Ah, that makes sense.
    |
    | >You want your .bashrc instead.
    | >However, presuming this is under a GUI login, if you just source your
    | >.bash_profile during the X11 startup and make sure you export $PS1 it
    | >_ought_ to work as on the console, avoiding the need to have a .bashrc
    | >(for this purpose, anyway).
    |
    | Putting PS1 in .bashrc sorted out xterm, thanks. Could you expand on
    | 'source your .bash_profile'?

    Exactly what you then tried ...

    | On the off chance, I added '~/.bash_profile' to .xinitrc, but it says
    | '/home/jzilla/.xinitrc: line 2: /home/jzilla/.bash_profile: Permission
    | denied'. It's permission 644 and I'm the owner.

    Two things:

    - you need to _source_ it, not invoke it like a program i.e.

    . $HOME/.bash_profile

    which runs it in the current shell, instead of

    $HOME/.bash_profile

    which runs it as a separate command.

    The latter will set up all the env vars in the subprocess, and
    then neatly discards them when the process finishes. The former
    does the setup for the current shell, thus leaving them around
    for inheritance by all the programs your X session spawns.

    - you may need execute permission:

    chmod 755 ~/.bash_profile

    The source command (".") might not need execute.

    And be sure your .bash_profile doesn't do interactive stuff.
    Needless to say, that won't work well during the GUI login:-)

    Cheers,
    --
    Cameron Simpson DoD#743
    http://www.cskk.ezoshosting.com/cs/

    O Beer! O Hodgson, Guinness, Allsopp, Bass!
    Names that should be on every infant's tongue! - C.S. Calverley

  6. Re: xterm not getting PS1 from .bash_profile

    Cameron Simpson wrote:
    > On 15:47 01 Feb 2004, jzilla wrote:


    > | On the off chance, I added '~/.bash_profile' to .xinitrc, but it says
    > | '/home/jzilla/.xinitrc: line 2: /home/jzilla/.bash_profile: Permission
    > | denied'. It's permission 644 and I'm the owner.


    You get Permission denied because you're attempting to execute a program
    that doesn't have the executable bit(s) set.

    BTW, if you're logging in via a GUI login manager, you should use
    ~/.xsession, and that must be executable. .xinitrc if for startx. I
    source .xsession from .xinitrc, that way I can start ssh-agent in
    ..xinitrc (Debian starts it for me in GUI logins).

    > Two things:
    >
    > - you need to _source_ it, not invoke it like a program i.e.
    >
    > . $HOME/.bash_profile
    >
    > which runs it in the current shell, instead of
    >
    > $HOME/.bash_profile


    The "." command (which is exactly the same as the "source" command) is
    exactly like an #include directive you would use in other programming
    languages.

    > - you may need execute permission:
    >
    > chmod 755 ~/.bash_profile
    >
    > The source command (".") might not need execute.


    No, it doesn't.

    --
    Cameron Kerr
    cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/
    Empowered by Perl!

  7. Re: xterm not getting PS1 from .bash_profile

    Cameron Kerr wrote:
    >
    > Cameron Simpson wrote:
    >
    >>On 15:47 01 Feb 2004, jzilla wrote:

    >
    >>| On the off chance, I added '~/.bash_profile' to .xinitrc, but it says
    >>| '/home/jzilla/.xinitrc: line 2: /home/jzilla/.bash_profile: Permission
    >>| denied'. It's permission 644 and I'm the owner.

    >
    > You get Permission denied because you're attempting to execute a program
    > that doesn't have the executable bit(s) set.
    >
    > BTW, if you're logging in via a GUI login manager, you should use
    > ~/.xsession, and that must be executable. .xinitrc if for startx. I
    > source .xsession from .xinitrc, that way I can start ssh-agent in
    > .xinitrc (Debian starts it for me in GUI logins).


    What login manager do you use?

    I'd probably use a login manager like gdm or xdm if I knew a simple way
    to have them run my window manager (sawfish). I looked into it a while
    back, but they both looked pretty hairy and typing 'xinit' isn't so hard.

    >>Two things:
    >>
    >> - you need to _source_ it, not invoke it like a program i.e.
    >>
    >> . $HOME/.bash_profile
    >>
    >> which runs it in the current shell, instead of
    >>
    >> $HOME/.bash_profile

    >
    >
    > The "." command (which is exactly the same as the "source" command) is
    > exactly like an #include directive you would use in other programming
    > languages.


    That's a really cool feature! Thanks for pointing it out, guys.

  8. Re: xterm not getting PS1 from .bash_profile

    jzilla wrote:

    > What login manager do you use?


    Personally, I use wdm (Wings Display Manager), which is more featureful
    than xdm, but doesn't have anything to do with KDE or GNOME.

    > I'd probably use a login manager like gdm or xdm if I knew a simple way
    > to have them run my window manager (sawfish). I looked into it a while
    > back, but they both looked pretty hairy and typing 'xinit' isn't so hard.


    That should be fairly automatic. Most distros should have an entry for
    each session type on their login widget.

    GDM should almost certainly run it without problem.

    --
    Cameron Kerr
    cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/
    Empowered by Perl!

+ Reply to Thread