Submitted by siteadmin on Tue, 07/08/2014 - 13:25
- Whole-line assignments
$x=value
Note that any quotations will not be removed but included as part of the value
- Inline assigments using $set
$set $x=value
- Inline assigments using $set
$set $x="value"
with value in quotations
- Inline assigments using $setval
$setval $x=value
with or without quotations
- If the assigned value does not contain variables that can be evaluated, then all three methods produce identical answers.
A. the assigned value is a single variable
$a=A-value
$w=$a
Whole line assignment results in $w containing: $a
$set $x=$a
Inline assignment results in $x containing: A-value
$set $y="$a"
Inline assignment results in $y containing: $a
$setval $z=$a
Inline assignment using setval results in $z containing: A-value
- Summary: $set and $setval both evaluate the variable, but quotes and whole-line assigments preserve the string exactly
B. the assigned value begins with a single variable
$w=$a plus more
Whole line assignment results in $w containing: $a plus more
$set $x=$a-plus-more
(set requires no spaces in value if quotes are not used)
Inline assignment results in $x containing: $a-plus-more
$set $y="$a plus more"
Inline assignment results in $y containing: $a plus more
$setval $z="$a plus more"
Inline assignment using setval results in $z containing: A-value plus more
- Summary: $set fails to do the evaluation. The others work as expected