[CentOS] Setting PS1 for ordinary users

James B. Byrne byrnejb at harte-lyne.ca
Wed Oct 10 16:12:24 EDT 2012


On: Wed Oct 10 15:58:43 EDT 2012 Bowie Bailey Bowie_Bailey at BUC.com
wrote:
> It doesn't matter where sh is pointing.  What matters is the
> shell configuration.
>
> I'm using bash here:
> $ which sh
> /bin/sh
> $ echo $SHELL
> /bin/bash
>
> So try 'echo $SHELL' instead of 'which sh' to see which shell
> you are using.

That seems to be the issue here.

[root at vhost04 ~]# echo $SHELL
/bin/bash

sh-4.1$ echo $shell

Examining the passwd file as suggested shows that root has :/bin/bash
and ordinary users have /bin/sh. And yet, the difference in behaviour
seems strange:

sh-4.1$ /bin/sh --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

[root at vhost04 ~]# /bin/bash --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

As far as I can see the two invocations call the same program.  And
yet, replacing /bin/sh with /bin/bash in the ordinary user's passwd
entry does indeed change the prompt to one identical to that used by
root.  Does anyone here know why this happens?

-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3



More information about the CentOS mailing list