bug-bash
[Top][All Lists]
Advanced

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

Re: set -x output of test operator is irretating


From: Chet Ramey
Subject: Re: set -x output of test operator is irretating
Date: Thu, 31 Jul 2008 01:20:07 -0400
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)

Toralf Förster wrote:

Bash Version: 3.2
Patch Level: 33
Release Status: release

Description:
        I'm wondering why in the example (see below) the right side is prefixed 
with a '\' wheras the left side is unchanged.

Repeat-By:
        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 ]]
        + read a b c d
        ++ echo -ne '\033]0;tfoerste@n22:~\007'

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.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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