From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21347 invoked from network); 27 Feb 1998 22:09:45 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 27 Feb 1998 22:09:45 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id QAA21413; Fri, 27 Feb 1998 16:51:17 -0500 (EST) Resent-Date: Fri, 27 Feb 1998 16:50:54 -0500 (EST) From: "Bart Schaefer" Message-Id: <980227135245.ZM22520@candle.brasslantern.com> Date: Fri, 27 Feb 1998 13:52:45 -0800 In-Reply-To: <199802272058.PAA00696@luomat.peak.org> Comments: In reply to Timothy J Luoma "(mime attachment!) debug function: first time weird behavior" (Feb 27, 3:58pm) References: <199802272058.PAA00696@luomat.peak.org> Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.820 20aug96) To: Timothy J Luoma , zsh-users@math.gatech.edu Subject: Re: (mime attachment!) debug function: first time weird behavior MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"JTaY11.0._D5.zKpzq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1346 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Feb 27, 3:58pm, Timothy J Luoma wrote: > Subject: (mime attachment!) debug function: first time weird behavior > > The first time it is run it says: > > /usr/local/lib/whois/ is a directory > whois: Have info archived: /usr/local/lib/whois/ > > If I run it again, it works fine. > > I am totally clueless Er, yes. :-) DIR=/usr/local/lib/whois FILE=$DIR/$LOOKFOR LOOKFOR=`echo $* | awk '{print $NF}'` Have you considered that perhaps you should assign a value to LOOKFORE -before- you use it to assign to another variable? DIR=/usr/local/lib/whois LOOKFOR=`echo $* | awk '{print $NF}'` FILE=$DIR/$LOOKFOR Also, you could use LOOKFOR=$*[$#] instead of that horrible awk.