On Sat, Sep 18, 2010 at 3:36 AM, Linda Walsh <[email protected]> wrote:
>
> ---
> If you would show me an example where pattern matching is
> disabled with ==, I might be more inclined to agree. But as I
> showed above, the pattern in $a matches regardless of double quoting.
glob="f??"
re="f.."
echo case:
case foo in
$glob) echo matches without quotes;;
*) echo do no match without quotes;;
esac
case foo in
"$glob") echo matches with quotes;;
*) echo do no match with quotes;;
esac
echo "= in [[ ]]"
if [[ foo = $glob ]]; then
echo matches without quotes
else
echo do no match without quotes
fi
if [[ foo = "$glob" ]]; then
echo matches with quotes
else
echo do no match with quotes
fi
echo "=~ in [[ ]]"
if [[ foo =~ $re ]]; then
echo matches without quotes
else
echo do no match without quotes
fi
if [[ foo =~ "$re" ]]; then
echo matches with quotes
else
echo do no match with quotes
fi
$ bash test/g
case:
matches without quotes
do no match with quotes
= in [[ ]]
matches without quotes
do no match with quotes
=~ in [[ ]]
matches without quotes
do no match with quotes