zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: Can this be done with an array parameter?
Date: Thu, 19 Feb 2004 17:16:44 +0000	[thread overview]
Message-ID: <1040219171644.ZM14255@candle.brasslantern.com> (raw)
In-Reply-To: <20040219164631.GB2804@DervishD>

On Feb 19,  5:46pm, DervishD wrote:
}
}     cat filename | while read line
}     do
}         info=($info $line)
}     done
} 
}     This effectively store every line as a separate item in the array
} parameter, which surprises me.  [...]
} 
} Zsh is reading my mind or so. Can anybody explain?

I note that PWS didn't bother to explain. :-)

Unless the SH_WORD_SPLIT option is set, variable references like $info
and $line aren't exactly quoted, but they aren't split up at spaces
either.  $info is an array, so it acts (almost) like "${info[@]}", but
$line is a scalar, so it acts (almost) like "$line".

The "almost" part has to do with what happens to array elements or
variables whose value is the empty string, and unset variables.  They
disappear entirely from the expanded command line rather than remaining
there as a quoted empty string.


  parent reply	other threads:[~2004-02-19 17:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-19 16:46 DervishD
2004-02-19 17:00 ` Peter Stephenson
2004-02-19 17:14   ` DervishD
2004-02-19 17:24     ` Peter Stephenson
2004-02-19 17:41       ` DervishD
2004-02-19 17:16 ` Bart Schaefer [this message]
2004-02-19 17:27   ` DervishD

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=1040219171644.ZM14255@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /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).