bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More fun with IFS


From: Chet Ramey
Subject: Re: More fun with IFS
Date: Thu, 31 Jan 2013 11:37:58 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2

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 credit for discovering this -- it was pointed 
> out 
> to me by some guys on IRC after demonstrating some other stuff.
> 
> And a quick test:
> 
> function expassign {
>       typeset -a a
>       a=("$@")
>       typeset var asn
> 
>       while IFS= read -r asn; do
>               IFS=: command eval "$asn"
>               printf '%-14s... %s\n' "$asn" "$var"
>       done <<\EOF
> var=${a[*]}
> var="${a[*]}"
> var=$*
> var="$*"
> var=${a[@]}
> var="${a[@]}"
> var=$@
> var="$@"
> EOF
> }
> 
> ${ZSH_VERSION+:} false && emulate ksh
> expassign one:::two three:::four

Thanks for the test case.  I had to fix the expansions of ${a[@]} and
${a[*]}, and those fixes will be in the next release.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]