View Single Post
  #4   (View Single Post)  
Old 23rd September 2010
rocket357's Avatar
rocket357 rocket357 is offline
Real Name: Jonathon
Wannabe OpenBSD porter
 
Join Date: Jun 2010
Location: 127.0.0.1
Posts: 429
Default

Quote:
Originally Posted by cq04cw View Post
the second form b=`eval echo \\$$_var` which i can't read it.
pass1: eval echo \$aa ## \\ -> \ (as manpage explained), $_var -> aa
pass2: eval it ? echo \$aa -> $aa , $aa is output of echo , b=$aa, but the result is b=AAAA ($aa's val).

how to understand the second form ?
The manpage states "a `\' followed by any of `$', ``', or `\' is stripped", so the first strip is for \\, leaving \$...but since \$ is in the list, too, the second \ is stripped as well, leaving $$_var, which is $aa, which evals to AAAA.

PHP Code:
set -x
$ `eval echo \\$$`
+ eval echo $$  
# BOTH \'s are stripped!
+ echo 31889
31889
/bin/ksh31889not found 
Reply With Quote