Curious bash evaluation
Chris Tyler
chris at tylers.info
Mon Dec 27 18:31:07 UTC 2010
On Mon, 2010-12-27 at 17:05 +0100, Rodolfo Alcazar Portillo wrote:
> Hello. See this:
>
> # A="echo 'hi'"
>
> # echo $($A)
> 'hi'
>
> # echo 'hi'
> hi
>
> Does anyone understand why does the first command
> evals the echo but echoes the simple quotes?
$() provides a type of quoting, so it's evaluated similar to:
"echo" "'hi'"
which produces the observed result.
-Chris
More information about the users
mailing list