command line prompt (need current directory)

Jonathan Bayer jbayer at ispi.COM
Fri Sep 14 13:00:52 AEST 1990


I know that this subject comes up about once a year or so.  Now it is my
turn :-)

I have a customer who wants/needs the prompt to show the current
directory (similar to MS-DOS :-(  ).  I reached back into my archives
and pulled out the following script:


	c()     # you might not be able to name this function `cd'
	{
		cd $1
		PS1="`pwd`> "
	}


This was placed into /etc/profile, and works well, until a new shell is
spawned.  The new shell does not inherit the shell function.  My
questions are:

	1.	How can I make the new shell inherit shell functions?

	2.	Is it possible to have a shell function have the same
		name as a real function (ie:  name this function "cd",
		and have it use the normal "cd" to change the
		directory)?

I will summarize to the net after stripping out all extraneous lines and
comments.

Thank you.


JB
-- 
Jonathan Bayer		Intelligent Software Products, Inc.
(201) 245-5922		500 Oakwood Ave.
jbayer at ispi.COM		Roselle Park, NJ   07204    



More information about the Comp.unix.shell mailing list