Korn Shell

heiby at mcdchg.UUCP heiby at mcdchg.UUCP
Thu Mar 12 01:34:16 AEST 1987


In article <580 at csun.UUCP> aeusesef at csun.UUCP (Sean Eric Fagan) writes:
>Yes, that is true.  My problem is that I would like to alias cd, which Korn
>shell will allow me to do.  Apparantly, it looks through aliases first,
>built-ins second, functions third, and PATH fourth.  I tried making a
>function called cd, but it didn't work, and an alias called cd did work, but
>I was unable to pass parameters into it.  Any one have any suggestions?

The trick is to create a function with a different name, then alias "cd"
to the name of that function.  Here's part of what I do for "cd".  I've
omitted the code for the "resetps1" function.

function ch {
	if cd ${*:-''}
	then
		resetps1
	else
		return 1
	fi
}
alias cd=ch	# make it easy to use
-- 
Ron Heiby, mcdchg!heiby		Moderator: mod.newprod & mod.os.unix
Motorola Microcomputer Division (MCD), Schaumburg, IL
"Save your energy.  Save yourselves.  Avoid the planet 'cuae2' at all costs!"



More information about the Comp.unix.questions mailing list