From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1444 invoked from network); 12 Jun 1998 16:56:26 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 12 Jun 1998 16:56:26 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id MAA01752; Fri, 12 Jun 1998 12:51:22 -0400 (EDT) Resent-Date: Fri, 12 Jun 1998 12:51:09 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980612095209.ZM22186@candle.brasslantern.com> Date: Fri, 12 Jun 1998 09:52:08 -0700 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@math.gatech.edu Subject: A useful alias for zsh scripting MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"Lx-_m3.0.lQ.xnLWr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1599 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Suppose you have a function that takes several positional parameters. It's often difficult to keep track of what each of them means. If you use $1 $2 etc. throughout your function, it becomes a chore to add parameters or to change the order, so you probably end up doing something like: thingtodo=$1 nameofthing=$2 whattosay=$3 and then using those names elsewhere in the function. Here's a handy alias to make it much easier to assign names to positional parameters. You use it like this: nameparams thingtodo nameofthing whattosay and the effect is the same as the three assignments above. The one thing this can't handle is positional parameters containing \0 (nul) bytes. alias nameparams 'print -rnN $* | IFS=$(print -N) read' If somebody knows a better way than $(print -N) to get a nul into IFS, I'm all ears. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com