Changing directories in ksh...
Bill.Stewart.[ho95c]
wcs at skep2.ATT.COM
Tue Jul 5 07:25:57 AEST 1988
In article <5318 at dasys1.UUCP> pepper at dasys1.UUCP (Angeli "Ms. Pepper" Wahlstedt) writes:
> Normally, I'd have an alias in "csh" that looks like this:
> alias down 'cd \!^; ls'
> But, here's the fun part...how do I do the same thing in ksh?? ...
> Also, ksh's alias isn't as...ummm...err..."intelligent" :as csh's alias.
Either you convince alias to give you access to arguments (i.e. read
the manual which I don't have here), or use shell functions
down(){
cd $* ; ls -FC
}
Shell functions are an SVR2 shell feature which ksh also supports.
A side benefit is that if you find yourself on a system that doesn't
have ksh, shell functions can let you create many of your favorite aliases.
The really fun part is if you want your command name to be "cd".
It's possible, but you have to do just the right things with
order-of-evaluation differences between built-ins, aliases, and
functions, and go three or so layers deep.
--
# Thanks;
# Bill Stewart, AT&T Bell Labs 2G218, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs
Rnmail: .signature too boring - deleted
More information about the Comp.unix.questions
mailing list