zsh-workers
 help / color / mirror / code / Atom feed
From: Bernd Eggink <eggink@rrz.uni-hamburg.de>
To: zsh-workers mailing list <zsh-workers@math.gatech.edu>
Cc: Peter Stephenson <pws@ifh.de>
Subject: Re: typeset question
Date: Thu, 09 Oct 1997 15:23:36 +0200	[thread overview]
Message-ID: <343CDAD8.CB7DDBF@rrz.uni-hamburg.de> (raw)
In-Reply-To: <199710091153.NAA04186@sgi.ifh.de>

Peter Stephenson wrote:
> 
> Bernd Eggink wrote:
> > I'm confused... These two statements work fine and give the same
> > results:
> >
> >       typeset x=(a b c)
> >
> >       x=($(cat file))
> 
> Actually, the first is not an array assignment; there is nothing
> syntactically special about the parentheses in a typeset statement.
> (In fact, it does grouping in all statements, to make globs using
> parentheses work sensibly, which is why the spaces don't separate words,
> but even so typeset just gets the string `x=(a b c)').  You should find
> x contains the string '(a b c)'.

My confusion was caused by a curious property of 'typeset'. If the
variable 
is already defined as a normal variable, and if it is an array, typeset 
does _nothing_. In all other cases it works as expected. Try this:

	x=a
	typeset x=b	
	print $x	# prints: b

OK... Now try

	unset x
	x=(a b c)
	typeset x=(x y z)
	print $x	# prints: a b c

The contents of the brace gets evaluated, but no assignment takes place.
Bug or 
feature? It's not documented nor does it make sense to me. 

--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@rrz.uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html


      reply	other threads:[~1997-10-09 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-09 10:10 Bernd Eggink
1997-10-09 11:53 ` Peter Stephenson
1997-10-09 13:23   ` Bernd Eggink [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=343CDAD8.CB7DDBF@rrz.uni-hamburg.de \
    --to=eggink@rrz.uni-hamburg.de \
    --cc=pws@ifh.de \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).