From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with ESMTP id UAA27351 for ; Mon, 11 Dec 1995 20:08:48 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id DAA14681; Mon, 11 Dec 1995 03:44:29 -0500 (EST) Resent-Date: Mon, 11 Dec 1995 03:44:29 -0500 (EST) From: sverre@research.nokia.com (Sverre Slotte) Message-Id: <9512110844.AA02049@nike.spices> Subject: Strange behaviour in zsh-2.5.03 To: zsh-workers@math.gatech.edu Date: Mon, 11 Dec 1995 10:44:03 +0200 (EET) Organisation: Nokia Research Centre X-Mailer: ELM [version 2.4 PL24] Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Resent-Message-ID: <"3f3MX1.0.Gb3.iz-om"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/684 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Hi, I'm running zsh version 2.5.03 on a Sun SparcStation 4 w/ Solaris 2.4. I have a shell function called "lpr" that acts as a front-end to /usr/ucb/lpr. It lets me specify the printer I want in a "localised" fashion: -Pf and -Pc stand for fax-room printer and coffee-room printer, respectively. Unfortunately, it fails in a mysterious manner. The function looks like this: function lpr() { local printer=${PRINTER:-your_default_printer} local passthru= while [[ $# -gt 0 ]] do case "$1" in -Pc | -PC | -Pps3ac ) printer=ps3ac # c for coffee-room ;; -Pf | -PF | -Pps3d ) printer=ps3d # f for fax-room ;; -P ) $[2]=$1$2 # turn -P prn into -Pprn ;; * ) passthru="$passthru $1" ;; esac shift done command lpr -P${printer} ${passthru} # this doesn't work! } (Comments on shell-programming style welcome.) The last line is the one that fails: if I try to print a file (e.g lpr -Pc foobar.ps) I get the response "lpr: cannot access foobar.ps". However, if I prepend the whole line with an echo, I get the expected result on stdout: "command lpr -Pps3ac foobar.ps". And if I replace the echo with eval, turning the line into eval command lpr -P${printer} ${passthru} everything works fine: no complaints at all and foobar.ps appears on the printer. Any explanation for this? Is is a bug? Is it already fixed in 2.6.whatever? Cheers, Sverre ---------------------------------------------------------------------------- Sverre Slotte Internet: sverre@research.nokia.com Nokia Research Center Phone: + 358 0 43766208 P.O.Box 45, 00211 Helsingfors, Finland Phax: + 358 0 43766856 ---------------------------------------------------------------------------- "Kajakken er uten sammenligning den ypperste enkeltmannsfarkost som finnes." -- Fritjof Nansen 1891