using cd command in a file

Tom Christiansen tchrist at convex.COM
Tue May 21 08:39:23 AEST 1991


>From the keyboard of ceblair at ux1.cso.uiuc.edu (Charles Blair):
:
:   I would like to get to a directory /me/A/B/C/D by just typing j.  I tried
:creating a file j with cd /me/etc in it, then chmod +x j.  It didn't work.
:Thanks in advance.  I'm sure I'm overlooking something well-known.

Like your nice value, uid, and umask, your current working directory 
is an attribute associated with a given process.  They are all inherited
by child processes, but changes in children are not propagated back up 
to the calling parent process.  That means a cd in a child is
not reflected in the parent.  You need to coerce the parent into
doing this itself, as in:

    alias j='cd /me/A/B/C/D'

--tom
--
Tom Christiansen		tchrist at convex.com	convex!tchrist
		"So much mail, so little time." 



More information about the Comp.unix.questions mailing list