Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!agate!ucbvax!unisoft!greywolf From: greywolf@unisoft.UUCP (The Grey Wolf) Newsgroups: comp.unix.shell Subject: Re: Passing parameters to an alias in ksh ...under AIX Message-ID: <3272@unisoft.UUCP> Date: 13 Dec 90 01:52:31 GMT References: <1235@lafayet.UUCP> Reply-To: greywolf@unisoft.UUCP (The Grey Wolf) Distribution: na Organization: Foo Bar and Grill Lines: 44 In article <1235@lafayet.UUCP> rob@lafayet.UUCP (Rob Freyder) writes: >I am trying to pass a parameter to an alias under AIX on the RS6000. >I would like to set up an alias that will take a directory name as an >argument and then print that in the title of my X window. I am not having >trouble changing the title ... that is a simple escape sequence. > >My Problem is that I cant get the alias to accept a parameter. I am using >$1 to reference the first parameter... Is this correct ? > >Thanks. Rob. You don't use aliases for this under ksh -- you use functions, like so: foo() { if [ "$1" = "bar" ] ; then echo "and grill :-)" fi } The positional parameters are interpreted in the context of the function; that is, none of the original "$@" is visible to the function unless ex- plicitly passed. If your ksh doesn't support functions it is most distinctly broken. [ I use ksh only when csh is not available. Having to type "fg %2" is a minor annoyance. Not having the set notation (such as {cat,man,do}_box expanding to cat_box man_box do_box) is a major annoyance. The command line editing is cute, but my fingers can figure out csh history quicker. The delays in ksh due to overhead in the shell (as compared to csh's overhead) are just noticeable enough to be a nuisance. Beats the HELL out of sh, though. ] >-- > ____ ____ ____ Core Lab - Western Atlas Int'l INC > \ \ / /\ / \ Rob Humans (318) 235-9431 > \ / /\ \/ /\ \ Freyder Internet rob@lafayet.waii.com > \/___/ \/___/ \__\ Bang ...!uunet!lafayet!rob -- On the 'Net: Why are more and more fourth-level wizard(-wannabe)s trying to invoke ninth-level magic, instead of taking the time to climb the other (quite essential) thirteen levels so they can do this properly? ...!{ucbvax,acad,uunet,amdahl,pyramid}!unisoft!greywolf