Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Strange behaviour in zsh-2.5.03



sverre@xxxxxxxxxxxxxxxxxx wrote:
> 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.

Here's the problem...

>                 * )
>                     passthru="$passthru $1"

...

>         command lpr -P${printer} ${passthru}    # this doesn't work!

it's shell word splitting.  You're trying to print " foo.ps".  Use
${=passthru} and everything should be OK.  Even better, make passthru
an array: that's what they're there for:

passthru=($passthru $1)

or if it has to work with ksh too,

set -A passthru $passthru $1

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



Messages sorted by: Reverse Date, Date, Thread, Author