zsh-users
 help / color / mirror / code / Atom feed
* funny behaviour of print
@ 1999-03-03  0:29 Gabor Egressy
  1999-03-03  2:23 ` Sweth Chandramouli
  0 siblings, 1 reply; 3+ messages in thread
From: Gabor Egressy @ 1999-03-03  0:29 UTC (permalink / raw)
  To: zsh-users

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
=== $ 

Is this a bug?  It certainly is unexpected behaviour.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: funny behaviour of print
  1999-03-03  0:29 funny behaviour of print Gabor Egressy
@ 1999-03-03  2:23 ` Sweth Chandramouli
  1999-03-03 13:12   ` Gabor Egressy
  0 siblings, 1 reply; 3+ messages in thread
From: Sweth Chandramouli @ 1999-03-03  2:23 UTC (permalink / raw)
  To: zsh-users

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

	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'.)

	-- sweth.

-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: funny behaviour of print
  1999-03-03  2:23 ` Sweth Chandramouli
@ 1999-03-03 13:12   ` Gabor Egressy
  0 siblings, 0 replies; 3+ messages in thread
From: Gabor Egressy @ 1999-03-03 13:12 UTC (permalink / raw)
  To: zsh-users

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'. :>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-03-03 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-03  0:29 funny behaviour of print Gabor Egressy
1999-03-03  2:23 ` Sweth Chandramouli
1999-03-03 13:12   ` Gabor Egressy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).