[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash doesn't act like mksh at all
From: |
Andres Perera |
Subject: |
bash doesn't act like mksh at all |
Date: |
Mon, 28 Feb 2011 07:15:14 -0430 |
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
- bash doesn't act like mksh at all,
Andres Perera <=