[SunHELP] ksh & PS1

Tim Longo tlongo at avaya.com
Tue Apr 2 12:01:55 CST 2002


I like to use a PS1 as follows for normal users:

HOST=`hostname|sed 's/\..*//'`
export HOST
PS1='
<$HOST:$PWD>
$ '

For my root accounts, I change the $ to a #.  Also for root, I set my shell
to /bin/sh, but change my shell to ksh in my .profile as follows:

if [ -x /bin/ksh ]
then
        SHELL=/bin/ksh
        export SHELL
        exec $SHELL
fi

Then, set some important vars in .kshrc

ENV=${HOME}/.kshrc
export ENV

My .kshrc has some aliases, and sources a file with some env variables.

If I want to use the user name, I use $LOGNAME.


> -----Original Message-----
> From: sunhelp-admin at sunhelp.org [mailto:sunhelp-admin at sunhelp.org]On
> Behalf Of Markham, Richard
> Sent: Tuesday, April 02, 2002 12:08 PM
> To: Sunhelp (sunhelp at sunhelp.org)
> Subject: [SunHELP] ksh & PS1
>
>
> under ksh, the below example will update the pwd as it changes but not the
> user if I su to user.  This is understood
> that if I used the '-' switch that it would run there profile and thus the
> same prompt would have to be in place
> in users profile.  I could set a $USER variable within each profile but I
> want to check if I'm reinventing the
> wheel first.  Interested in anyones solutions and thanks for comments.
>
> export PS1='('`whoami`'@'`uname -n`')$PWD-> '



More information about the SunHELP mailing list