Difference between revisions of "$eval"

From Scriptwiki
Jump to: navigation, search
m
 
m
Line 12: Line 12:
 
This would echo "%var" since the string is evaluated once.
 
This would echo "%var" since the string is evaluated once.
 
notice that this is the same as echoing %string
 
notice that this is the same as echoing %string
   echo -a $eval(%strin,2)
+
   echo -a $eval(%string,2)
 
This would echo "m00" since the string is first evaluated to %var and %var is then evaluated to m00
 
This would echo "m00" since the string is first evaluated to %var and %var is then evaluated to m00

Revision as of 21:32, 5 July 2006

Returns the string N times evaluated.

 $eval(string,N)

If N isn't specified, N is set to 1.

Example:

 var %var = m00
 var %string = % $+ var

Now echoing %var would echo "m00" and echoing %string would echo "%var"

 echo -a $eval(%string,0)

This would echo "%string" since the string is not evaluated.

 echo -a $eval(%string,1)

This would echo "%var" since the string is evaluated once. notice that this is the same as echoing %string

 echo -a $eval(%string,2)

This would echo "m00" since the string is first evaluated to %var and %var is then evaluated to m00