Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!genrad!decvax!tektronix!tekgen!tektools!jerryp From: jerryp@tektools.UUCP Newsgroups: comp.unix.questions Subject: Re: Korn Shell (alias for 'cd') Message-ID: <2295@tektools.TEK.COM> Date: Mon, 23-Mar-87 03:15:49 EST Article-I.D.: tektools.2295 Posted: Mon Mar 23 03:15:49 1987 Date-Received: Wed, 25-Mar-87 00:49:34 EST References: <580@csun.UUCP> Reply-To: jerryp@tektools.UUCP (Jerry Peek) Organization: Tektronix, Inc., Beaverton, OR. Lines: 25 Keywords: Korn shell ksh aliases parameters oops In article <580@csun.UUCP> aeusesef@csun.UUCP (Sean Eric Fagan) writes: > ... 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? I have an alias like this; it takes commandline parameters just fine: alias cd='. $HOME/.ksh/cd' # CHANGE DIRECTORY, RESET PROMPT Here's what's in the $HOME/.ksh/cd file: \cd $1 # \ MEANS USE REAL cd COMMAND, NOT ALIAS cdstat=$? # SAVE cd STATUS FOR cl ALIAS PS1="<`prompt ~ \`/bin/pwd\``,!> " # BUILT-IN pwd CAN'T HANDLE SYMLINKS set -- # CLEAR OUT POSITIONAL PARAMETERS FOR NEXT ALIAS (The "prompt" command is a prompt-generator.) --Jerry Peek, Tektronix, Inc. US Mail: MS 74-900, P.O. Box 500, Beaverton, OR 97077 uucp-style: {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp Domain-style: jerryp@tektools.TEK.COM Phone: +1 503 627-1603