🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1137

command line prompt (need current directory)

#1137
From: Jonathan Bayer
Date: Fri, 14 Sep 1990 03:00
38 lines
1318 bytes
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@ispi.COM		Roselle Park, NJ   07204    
Technical Details
Message-ID: <1683@ispi.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ispi!jbayer

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ispi!jbayer
From: jbayer@ispi.COM (Jonathan Bayer)
Newsgroups: comp.unix.shell
Subject: command line prompt (need current directory)
Message-ID: <1683@ispi.COM>
Date: 14 Sep 90 03:00:52 GMT
Distribution: comp
Organization: Intelligent Software Products, Inc.
Lines: 38