"Real" Shells

tim at ism780c.UUCP tim at ism780c.UUCP
Thu Feb 11 10:22:19 AEST 1988


In article <199 at mccc.UUCP> pjh at 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 at ism780c.ism.com
"There is no dark side of the force.  As a matter of fact, it's all dark"



More information about the Comp.unix.wizards mailing list