[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash doesn't act like mksh at all
From: |
Chet Ramey |
Subject: |
Re: bash doesn't act like mksh at all |
Date: |
Thu, 03 Mar 2011 22:57:36 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 |
On 2/28/11 6:45 AM, Andres Perera wrote:
> for i in bash mksh; do
> echo $i:
> $i <<'!'
> set 'a b' 'c d'
> quoted="$@"
> unquoted=$@
> echo "$quoted"
> echo "$unquoted"
> !
> done
>
> here bash treats unquoted $@ on rhs differently, expanding it like $*:
>
> bash:
> a b c d
> a b c d
> mksh:
> a b c d
> a b c d
>
> persists after turning on posix-compat mode:
>
> bash -o posix -c 'set "a b" "c d"; unquoted=$@; echo "$unquoted"'
> a b c d
>
>
> the shell is treating $@ and "$@" like special tokens in assignments,
> which is wrong
Thanks for the report. The shell is inappropriately splitting the
unquoted $@ when it appeared on the rhs of an assignment statement. This
will certainly be fixed for the next version, and may appear as a
patch to bash-4.2.
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/
- Re: bash doesn't act like mksh at all,
Chet Ramey <=