|
From: | Chet Ramey |
Subject: | Re: Curious special parameter expansion when IFS is null |
Date: | Sun, 08 Feb 2004 19:10:55 -0500 |
User-agent: | Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 |
A. Alper ATICI wrote:
Bash Version: 2.05b Patch Level: 0 Release Status: release Description: $ set a b c; IFS=, a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b" a b c a,b,c a b c a,b,c $ set a b c; IFS= a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b" a b c a b c abc abc Considering the output when IFS=, is correct; what's the explanation of the output when IFS is null unless it is a bug?
Which part do you consider a bug? For the assignment to `a', the standard requires that, when unquoted, $* expand to the positional parameters starting from 1. It has to be done in such a way that even when IFS is null they expand into separate arguments. (So there is no difference between $@ and $* when unquoted.) For the assignment to `b', the standard requires that when IFS is null the parameters be concatenated. Chet
[Prev in Thread] | Current Thread | [Next in Thread] |