PS1, $PWD and /sbin/sh

PS1, $PWD and /sbin/sh

Post by Jim Louck » Sat, 06 Dec 1997 04:00:00



We're trying to get PS1 to print the current working directory
with /sbin/sh (for root, Solaris 2.5.1 and 2.6).  The following
works for /bin/ksh:

        PS1="`hostname`:\$PWD ($LOGNAME)
        -> "; export PS1

I thought I was able to accomplish this once on Solaris. It works
for HPUX 10.20 (but I think /sbin/sh is Posix on HP).

--

 
 
 

PS1, $PWD and /sbin/sh

Post by Roland Titze US/EC2 60/2/162 #4175 » Tue, 09 Dec 1997 04:00:00



> We're trying to get PS1 to print the current working directory
> with /sbin/sh (for root, Solaris 2.5.1 and 2.6).  The following
> works for /bin/ksh:

>         PS1="`hostname`:\$PWD ($LOGNAME)
>         -> "; export PS1

> I thought I was able to accomplish this once on Solaris. It works
> for HPUX 10.20 (but I think /sbin/sh is Posix on HP).

Hi Jim,

unfortunately the Bourne Shell does not support $PWD.
Further you need an alias feature for redefining of the cd command,
but the Bourne Shell does not support the alias command.
I think the printing of the current working directory in the prompt
of the Bourne Shell is not possible.

Regards Roland

 
 
 

1. /sbin/sh and /sbin/sh

Does anyone know the difference between /sbin/sh and /bin/sh ?

Please send me a copy of your reply by Email.

--
Marco Davids                     +31(0)15 8881000 fax: +31(0)15 8881099

Systemadministrator              http://www.casema.net/~mdavids

2. Cable TV on Sun Ultra?

3. PS1='[$PWD]'; how can I reduce the length of PS1 when it is long?

4. SCSI Locks Up, but IDs seem okay?!

5. root's shell, /sbin/sh, /bin/sh and /usr/ksh

6. Running X Windows

7. Any difference between /sbin/sh and /bin/sh?

8. modem question?

9. diff /sbin/sh and /bin/sh?

10. /sbin/sh and /bin/sh

11. /bin/sh .vs. /sbin/sh

12. difference between /bin/sh and /sbin/sh

13. /sbin/sh and /bin/sh