Re: More fun with IFS

2013-03-01 Thread Dan Douglas
On Friday, March 01, 2013 01:06:27 PM Thorsten Glaser wrote: > Hrm, but the docs, both, specifically say that (unquoted) $@ behaves > like $* except in the face of no arguments, so I cannot do that. > > But thanks for the feedback. My reading differed, but you have a > point, and the others can be

Re: More fun with IFS

2013-03-01 Thread Thorsten Glaser
Dan Douglas dixit: >For "$@" that sounds about right. I think it would be preferable if x="$@" and >x=$@ were the same. If a user wants IFS-delimited they should probably use Hrm, but the docs, both, specifically say that (unquoted) $@ behaves like $* except in the face of no arguments, so I ca

Re: More fun with IFS

2013-03-01 Thread Dan Douglas
On Friday, March 01, 2013 11:49:37 AM Thorsten Glaser wrote: > Dan Douglas dixit: > > >Well, ok then. I'm just nitpicking here. I think this makes sense because > >distinguishes between $@ and $* when assigning to a scalar, so that the end > >result of $@ is always space-separated, as spaces deli

Re: More fun with IFS

2013-03-01 Thread Thorsten Glaser
Dan Douglas dixit: >Well, ok then. I'm just nitpicking here. I think this makes sense because it >distinguishes between $@ and $* when assigning to a scalar, so that the end >result of $@ is always space-separated, as spaces delimit words during command […] >Consider for example if you ever imp

Re: More fun with IFS

2013-02-28 Thread Dan Douglas
On Wednesday, February 27, 2013 01:31:58 PM Thorsten Glaser wrote: > Why whitespace? $IFS certainly contains none. And the usual > insertion rules all specify the first character of $IFS and > specify what to do if $IFS is empty or unset (which it isn’t > in these examples). Well, ok then. I'm jus

Re: More fun with IFS

2013-02-27 Thread Thorsten Glaser
Dan Douglas dixit: >of any reason it should be inserting a '':'' between the two arguments, >especially for the ''$@'' variants, either quoted or unquoted. It certainly >can't be because of a word splitting step. ‘:’ is ${IFS::1} and inserted because of the word *concatenation* (not splitting)

Re: More fun with IFS

2013-02-26 Thread Dan Douglas
On Sunday, February 24, 2013 10:26:52 PM Thorsten Glaser wrote: > Dan Douglas dixit: > > >Zsh and pdkshes produce: > > > >one:::two:three:::four > > > >For all of the above, which I think is wrong for the last 4. ksh93 > >produces: > > Why is it incorrect? This test was intended to demonstrate e

Re: More fun with IFS

2013-02-24 Thread Thorsten Glaser
Dan Douglas dixit: >Zsh and pdkshes produce: > >one:::two:three:::four > >For all of the above, which I think is wrong for the last 4. ksh93 produces: Why is it incorrect? The mksh manpage documents $@ behaving like $*: @ Same as $*, unless it is used inside double quotes, in which c

Re: More fun with IFS

2013-01-31 Thread Chet Ramey
On 1/30/13 1:03 AM, Dan Douglas wrote: > Hi everyone, and welcome to another edition of IBOTD (IFS-bug-of-the-day), > featuring everyone's favorite Bourne shell kludge: word-splitting! > > On today's episode - inconsistencies within assignments that depend upon > quoting. Though I can't take cre

Re: More fun with IFS

2013-01-30 Thread Dan Douglas
On Wednesday, January 30, 2013 11:35:55 AM Chet Ramey wrote: > On 1/30/13 2:47 AM, Dan Douglas wrote: > > > No, $* always expands to a single word. If multiple words result, those > > are > > the result of field-splitting, not an intrinsic multi-word expansion as in > > the > > case of $@. Thoug

Re: More fun with IFS

2013-01-30 Thread Chet Ramey
On 1/30/13 2:47 AM, Dan Douglas wrote: > No, $* always expands to a single word. If multiple words result, those are > the result of field-splitting, not an intrinsic multi-word expansion as in > the > case of $@. Though POSIX says very little about the unquoted cases. I haven't looked at the

Re: More fun with IFS

2013-01-30 Thread Andreas Schwab
"Chris F.A. Johnson" writes: > On Wed, 30 Jan 2013, Andreas Schwab wrote: > >> "Chris F.A. Johnson" writes: >> var=${a[*]} ... one two three four # bad >>> >>>Looks good to me. It expands to multiple words, just as an unquoted >>>$* would do. >> >> But no field splitting is p

Re: More fun with IFS

2013-01-30 Thread Chris F.A. Johnson
On Wed, 30 Jan 2013, Andreas Schwab wrote: "Chris F.A. Johnson" writes: var=${a[*]} ... one two three four # bad Looks good to me. It expands to multiple words, just as an unquoted $* would do. But no field splitting is performed on the expansion, so why are the colons lost?

Re: More fun with IFS

2013-01-30 Thread Andreas Schwab
"Chris F.A. Johnson" writes: >> var=${a[*]} ... one two three four # bad > >Looks good to me. It expands to multiple words, just as an unquoted >$* would do. But no field splitting is performed on the expansion, so why are the colons lost? Andreas. -- Andreas Schwab, sch...@lin

Re: More fun with IFS

2013-01-29 Thread Dan Douglas
On Wednesday, January 30, 2013 02:00:26 AM Chris F.A. Johnson wrote: > On Wed, 30 Jan 2013, Dan Douglas wrote: > > > Hi everyone, and welcome to another edition of IBOTD (IFS-bug-of-the-day), > > featuring everyone's favorite Bourne shell kludge: word-splitting! > > > > On today's episode - incons

Re: More fun with IFS

2013-01-29 Thread Chris F.A. Johnson
On Wed, 30 Jan 2013, Dan Douglas wrote: Hi everyone, and welcome to another edition of IBOTD (IFS-bug-of-the-day), featuring everyone's favorite Bourne shell kludge: word-splitting! On today's episode - inconsistencies within assignments that depend upon quoting. Though I can't take credit for

More fun with IFS

2013-01-29 Thread Dan Douglas
Hi everyone, and welcome to another edition of IBOTD (IFS-bug-of-the-day), featuring everyone's favorite Bourne shell kludge: word-splitting! On today's episode - inconsistencies within assignments that depend upon quoting. Though I can't take credit for discovering this -- it was pointed out t