Quote:
Originally Posted by cq04cw
PHP Code:
$ b=$( eval echo \$$_var ) # this method as expected $ b=`eval echo \$$_var` # this method not as expected ,should it be same result as previous method?
|
On OpenBSD-CURRENT, which exhibits the same behavior:
Quote:
Originally Posted by man ksh
For $(command) substitutions, normal quoting rules are used when command is parsed; however, for the `command` form, a `\' followed by any of `$', ``', or `\' is stripped (a `\' followed by any other character is unchanged).
|
Simply put, for `command` form substitution, \$ is treated in a special manner and what you get from \$$ is $$, or the pid of the shell you're working in right now.
PHP Code:
$ echo $$
21638
$ ksh
$ echo $$
12413
$ exit
$ echo $$
21638
This, however, works:
PHP Code:
b=`eval echo \\$$_var`