From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9184 invoked from network); 3 Mar 1999 13:13:24 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Mar 1999 13:13:24 -0000 Received: (qmail 17042 invoked by alias); 3 Mar 1999 13:12:14 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2198 Received: (qmail 17026 invoked from network); 3 Mar 1999 13:12:12 -0000 Message-ID: <19990303081209.A20310@vmunix.com> Date: Wed, 3 Mar 1999 08:12:09 -0500 From: Gabor Egressy To: zsh-users@sunsite.auc.dk Subject: Re: funny behaviour of print References: <19990302192948.A15698@vmunix.com> <19990302212344.A21122@astaroth.nit.gwu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.1i In-Reply-To: <19990302212344.A21122@astaroth.nit.gwu.edu>; from Sweth Chandramouli on Tue, Mar 02, 1999 at 09:23:44PM -0500 X-Operating-System: FreeBSD 2.2.7-STABLE i386 On Tue, Mar 02, 1999 at 09:23:44PM -0500, Sweth Chandramouli wrote: # On Tue, Mar 02, 1999 at 07:29:48PM -0500, Gabor Egressy wrote: # > I get weird behaviour with print. If I print a variable which is # > something like below, I get a complaint from it. # > # > === $ echo $CTAGS # > --langmap=c:.c.ec.y.l --c-types=cdefgmnstuvx --kind-long=yes # > === $ print $CTAGS # > zsh: bad option: -a # > zsh: exit 1 # > === $ print --------l hello world # > hello # > world # > === $ # # i don't get the exit 1 running zsh 3.1.5, but otherwise # i've seen the same behaviour. two things seem odd about it. # a) echo assumes that if the first "flag" seen isn't # valid then no flags were intended (and instead interprets the # "flags" as arguments to be echoed), while print assumes that if # the first "flag" seen isn't valid then it was passed a list of # invalid flags, and complains; and # b) echo does not accept flags after a double-hyphen, whereas # print does: # (astaroth/1909)~: echo -e bob # bob # (astaroth/1910)~: echo --e bob # --e bob # (astaroth/1911)~: print -l bob # bob # (astaroth/1912)~: print --l bob # bob But if you look, you'll see it accepts any number of dashes. Which I find rather silly. # i guess the immediate workaround would be to alias the builtins # so that flags were explicitly ignored, with something like # $ alias echo='echo -' ; alias print='print -' # (if you wanted to set any flags, of course, you would have to # then do a `builtin print' or `builtin echo'.) :) a bit of a pain for a solution. Just have to use print -- $CTAGS as that works. I still would like to know if this is a bug or a 'feature'. :>