[comp.unix.wizards] "Real" Shells

pjh@mccc.UUCP (Peter J. Holsberg) (02/10/88)

You recently posted that 
	PS1="."
displays the current directory "...with any real shell".  Since it doesn't
work with the Bourne shell on SysV R3.0, I wonder what you mean by a "real
shell", C shell only????

-- 
Peter Holsberg                  UUCP: {rutgers!}princeton!mccc!pjh
Technology Division             CompuServe: 70240,334
Mercer College                  GEnie: PJHOLSBERG
Trenton, NJ 08690               Voice: 1-609-586-4800

gwyn@brl-smoke.ARPA (Doug Gwyn ) (02/10/88)

In article <199@mccc.UUCP> pjh@mccc.UUCP (Peter J. Holsberg) writes:
>You recently posted that 
>	PS1="."
>displays the current directory "...with any real shell".  Since it doesn't
>work with the Bourne shell on SysV R3.0, I wonder what you mean by a "real
>shell", C shell only????
	Script started on Tue Feb  9 17:32:42 1988
	[env]SMOKE$ PS1="."
	.echo okay
	okay
	.exit
	script done on Tue Feb  9 17:33:00 1988

Sure seems to work.  Or maybe you don't appreciate the humor?

ron@topaz.rutgers.edu (Ron Natalie) (02/10/88)

> You recently posted that 
>	PS1="."
> displays the current directory "...with any real shell".  Since it doesn't
> work with the Bourne shell on SysV R3.0, I wonder what you mean by a "real
> shell", C shell only????

Bourne shells are the only real shells.

$ PS1="."
.ls -ldi $PS1
65542 drwxr-xr-x 15 ron          4096 Feb  9 17:55 .

Looks like the current directory to me.

-Ron

pjh@mccc.UUCP (Peter J. Holsberg) (02/10/88)

Sad, but true: I didn't get the joke!  Thanks to all those who pointed out
via EMAIL that I had missed the point. 
-- 
Peter Holsberg                  UUCP: {rutgers!}princeton!mccc!pjh
Technology Division             CompuServe: 70240,334
Mercer College                  GEnie: PJHOLSBERG
Trenton, NJ 08690               Voice: 1-609-586-4800

wnp@dcs.UUCP (Wolf N. Paul) (02/10/88)

In article <199@mccc.UUCP> pjh@mccc.UUCP (Peter J. Holsberg) writes:
|You recently posted that 
|	PS1="."
|displays the current directory "...with any real shell".  Since it doesn't
|work with the Bourne shell on SysV R3.0, I wonder what you mean by a "real
|shell", C shell only????
|

I THINK this was supposed to be a joke. If you set PS1=".", your prompt
will be ".", and "." on UNIX is ALWAYS the current directory :-) ...

This works with the Bourne shell on SysVR3, only its not very informative.

tim@ism780c.UUCP (02/11/88)

In article <199@mccc.UUCP> pjh@mccc.UUCP (Peter J. Holsberg) writes:
< You recently posted that 
< 	PS1="."
< displays the current directory "...with any real shell".  Since it doesn't
< work with the Bourne shell on SysV R3.0, I wonder what you mean by a "real
< shell", C shell only????

Don't be silly.  If he meant csh, he would have said

	set prompt=.

Anyway, as the person who first suggested "PS1=.", I assure you that
it works quite well on SysV R3.0.  That is where I first used it.
It works in all versions of the shell that I am aware of going
back to at least v6.  If it really fails to work on your SvsV R3
shell, I suggest contacting your vendor.

I won't claim that this path to getting the current directory in your
prompt is the most absolutely useful, but it is relatively good.  Just
remember, wherever you go, there you are.

If you don't believe it, here are some examples:

	$ PS1=.
	.echo $PS1
	.
	.pwd
	.
	. # note that 'pwd' and 'echo $PS1' gave the same result
	.ls
	(files in current directory)
	.ls $PS1
	(files in current directory)
	.ls `pwd`
	(files in current directory)

That should convince you that it works.

By the way, if for some reason you wanted the parent directory of
the current directory, you could try

	PS1=..

If you wanted the grandparent, try

	PS1=../..

etc, etc.  These all work.
-- 
Tim Smith					tim@ism780c.ism.com
"There is no dark side of the force.  As a matter of fact, it's all dark"

gwyn@brl-smoke.ARPA (Doug Gwyn ) (02/11/88)

In article <17933@topaz.rutgers.edu> ron@topaz.rutgers.edu (Ron Natalie) writes:
>Bourne shells are the only real shells.

And some are realer than others.

By the way, those of you with a recent release of the BRL SVR2 Bourne
shell that need to port it to Suns:  I recently did this; mostly it was
a matter of finding all the #if defined(BSD) || defined(BSD_SYSV) code
and adding || defined(sun) to it, plus using the dirent-based directory
library in subdirectory "ndir" (define NFS in the Makefile).  The edit.c
(interactive history editing) module also needs the ICRNL tweak disabled
for the Sun; apparently (at least on SunOS 3.2) their termio emulation
couples the I- and O- carriage-return/line-feed mapping to the same
CRMOD stty bit, and the I- mapping has precedence over the O- one.
There were a couple of minor tweaks other than the above, but nothing
too difficult to find and fix.

If the above makes no sense to you, you probably shouldn't be trying
to port the software.  You can get a Sun version from me, if I have
a copy of your AT&T UNIX System V Release 2.0 or later source license
on file.

pjh@mccc.UUCP (Peter J. Holsberg) (02/12/88)

Thnaks, Tim.  That really cleared things up!
-- 
Peter Holsberg                  UUCP: {rutgers!}princeton!mccc!pjh
Technology Division             CompuServe: 70240,334
Mercer College                  GEnie: PJHOLSBERG
Trenton, NJ 08690               Voice: 1-609-586-4800