[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set -x and parameter expansion
From: |
Peggy Russell |
Subject: |
Re: set -x and parameter expansion |
Date: |
Mon, 14 Mar 2011 06:38:03 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
> 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