Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15477
| From | "" <kfm@plushkava.net> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Is this a bug by any chance? |
| Date | 2019-10-05 20:43 +0100 |
| Message-ID | <mailman.1058.1570304608.2651.bug-bash@gnu.org> (permalink) |
| References | <99440807.4131727.1570301315442.ref@mail.yahoo.com> <99440807.4131727.1570301315442@mail.yahoo.com> <20191005204320.5ada9d998f011fd8f0b37d9b@plushkava.net> |
On Sat, 5 Oct 2019 18:48:35 +0000 (UTC) George R Goffe via Bug reports for the GNU Bourne Again SHell <bug-bash@gnu.org> wrote: > Hi, > > I just built the latest bash in an effort to determine if thie script shows a bug or a ufu. Can you help me please? > > I was expecting to see: > 12345 > > Best regards AND thanks for your help, > > George... > > #!./bash -xv > x="1 2 3 4 5" > + x='1 2 3 4 5' > for z in "$x" > do > echo "$z" > done > + for z in "$x" > + echo '1 2 3 4 5' > 1 2 3 4 5 > exit 0 > + exit 0 > > It's definitely not a bug. Quoting the expansion inhibits word splitting. Your loop iterates once over a single word. Said word is conveyed to echo as a single argument. In this case, said argument is printed by echo, with the addition of a newline character. If your ultimate intent is to store an arbitrary list of strings in a variable prior to iterating over them, you should use an array variable instead. As such, this would be a topic better suited to the help-bash list. -- Kerin Millar
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Is this a bug by any chance? "" <kfm@plushkava.net> - 2019-10-05 20:43 +0100
csiph-web