| Subject: | Re: set -x output of test operator is irretating |
|---|---|
| From: | Bob Proulx <bob@xxxxxxxxxx> |
| Date: | Thu, 31 Jul 2008 11:12:53 -0400 |
| Newsgroups: | gnu.bash.bug |
Chet Ramey wrote: > Toralf Förster wrote: > > I'm wondering why in the example (see below) the right side is > > prefixed with a '\' wheras the left side is unchanged. > >... > > tfoerste@n22 ~ $ echo "1 2 3 4" | while read a b c d; do [[ "$a" = > > "$b" || "$a" = "$c" || "$a" = "$d" ]] && echo oops; done > > + read a b c d > > + echo '1 2 3 4' > > + [[ 1 = \2 ]] > > + [[ 1 = \3 ]] > > + [[ 1 = \4 ]] > > Because the ==/!=/= operators are defined to match the rhs as a pattern > unless it's quoted. You quoted the original string, and the `set -x' > output is supposed to be re-usable as input, so the trace output is > quoted appropriately. Of course that makes sense for the "==" and "!=" cases. But is that true even for the "=" case? For the "=" case I thought it was "STRING1 = STRING2" and not "STRING = PATTERN". Could you clarify the rules and educate us? Thanks Bob |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: function name bug ?, Jan Schampera |
|---|---|
| Next by Date: | Re: set -x output of test operator is irretating, Jan Schampera |
| Previous by Thread: | Re: set -x output of test operator is irretating, Chet Ramey |
| Next by Thread: | Re: set -x output of test operator is irretating, Jan Schampera |
| Indexes: | [Date] [Thread] [Top] [All Lists] |