bug-bash
[Top][All Lists]
Advanced

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

Re: RFE: request for quotes as grouping operators to work in brackets as


From: Pierre Gaston
Subject: Re: RFE: request for quotes as grouping operators to work in brackets as elsewhere.
Date: Sat, 18 Sep 2010 08:19:12 +0300

On Sat, Sep 18, 2010 at 3:36 AM, Linda Walsh <address@hidden> 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



reply via email to

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