ksh prompt (PS1) and cd

ksh prompt (PS1) and cd

Post by Marcus Schwan » Wed, 05 Aug 1992 19:01:19

>>"Using ksh, how can one alias "cd" to change directory as well as
>>"to set PS1 to $PWD.
>>"I tried:
>>"alias cd="cd; PS1=$PWD"
>>"but didn't work.

Jeff Conner writes

Quote:> PS1='$PWD $ '                   export PS1

Right! I found the following quite nice: it leaves you
still some room to type in your command line, as long as you are
moving within your home directory.

export PS1='${PWD#$HOME/}: $ '


Marcus Sch*l, Siemens Nixdorf Informationssysteme AG, STM OS 323
Address:    Otto-Hahn-Ring 6, W-8000 Muenchen 83, Germany

Phone:      +49-89-636-42436


1. How to translate Linux's PS1 prompt to Unix's PS1 prompt?

Hi all,

I tried to write a script  that can display the prompt as Linux does for



Here is my script (It works on ksh of UnixWare 7)

UID=`id -u`
if [ $UID -eq 0 ]; then

# '

$ '

but It will not display properly after running the command 'priv' to become
another users.

I wonder if I can do a script that can display the prompt as Linux prompt on
almost Unix system in Bourne Shell or Korn Shell without to install Bash.

 Thanks in advance for any advise.


2. Linux-Mandrake Kernel Compile Error

3. ksh prompt (PS1) and cd

4. mail syslog

5. How to translate Linux's PS1 prompt to Unix's PS1 prompt?

6. Linux PC Cluster linked to departmental machines?

7. Displaying time in PS1 prompt (ksh on HPUX 9.01 or 10.0)

8. Looking to buy a DEC

9. Settiing prompt in ksh... (cd bang!dir)

10. ksh... PS1=$$ PS1="$$" PS1='$$'... aargh...

11. Setting PS1 to emulate DOS type prompt

12. PS1 prompt customization