From: ab on
Hi,

I have a question about setting PS1 variable after user execute
"su" ( without "-" ) command.

I know that when user execute "su" command any profiles files
aren't loaded. So my question is, if is possible to set variable PS1
to show current working dir in prompt in other place than profile
files.

Thanks in advance.

ab

From: Brian Mac on
hi ab,

you probably could (with the shell many things are possible) but why
would you want to? you could set the PS1 variable in your current
user's shell (user you run the su command as) by using the following
syntax in korn shell (maybe in the $HOME/.kshrc if you've defined ENV
correctly in the $HOME/.profile):

PS1='${PWD} $ }'
export PS1

when you run 'su other_username' (no minus), PS1 will still be set to
your current directory. please note the single quotes around the
variable (not double quotes or back-quotes). please note this will
work for the bourne and korn shells. i make no guarantees about other
shells ;-)

hope this helps,
brian

On Feb 13, 3:26 am, "ab" <adam.ba...(a)googlemail.com> wrote:
> Hi,
>
> I have a question about setting PS1 variable after user execute
> "su" ( without "-" ) command.
>
> I know that when user execute "su" command any profiles files
> aren't loaded. So my question is, if is possible to set variable PS1
> to show current working dir in prompt in other place than profile
> files.
>
> Thanks in advance.
>
> ab