> The `r' is not a word expansion.  It's a word that's evaluated as an
> expression when the command is executed.  Arithmetic expansion is
> the $((...)) word expansion.

The command being [[ and the dollar-sign indicating the expansion.

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).  

Can users see more trace info on what happens within [[ (i.e.; [['s value for 
r)?

Thank you.
Peggy Russell


Reply via email to