[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set -x and parameter expansion
From: |
Chet Ramey |
Subject: |
Re: set -x and parameter expansion |
Date: |
Mon, 14 Mar 2011 14:31:17 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 |
On 3/14/11 2:38 AM, Peggy Russell wrote:
> This helps clarify the "set -x" difference below which show $r going through
> parameter expansion done by the shell before the command [[ sees the
> expression.
> Okay...
>
> command [[ that
> contains expr set -x
> --------------- --------------
> [[ $? -eq r ]] + [[ 0 -eq r ]] * [[ used the contents of r which
> was 0
> [[ $? -eq $r ]] + [[ 0 -eq 0 ]]
> [[ $? -eq ${r:=0} ]] + [[ 0 -eq 0 ]]
>
> For a user to see/trace r, they would either echo/printf, declare -p r,
> or refer to it as $r (displayed by set -x).
Yes.
> Can users see more trace info on what happens within [[ (i.e.; [['s value for
> r)?
No.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/