eval

Usage

eval expression

Description

NOTE: This command has very different behavior from XSH1 eval alias for perl.

This command first evaluates a given expression to obtain a string, then evaluates this string as XSH2 code in the current context, returning the return value of the last evaluated command. This command raises an exception if either expression evaluates to invalid XSH2 code or if evaluating the code raises an exception.

Example 28. Evaluate "in-line" XSH snippets within a XML document

foreach //inline-xsh eval .;