05-25-2011 02:17 PM
I am trying to complete the Try It Yourself on page 37 of This Week Deploying Junos Automation but I am getting the following error and don't know why. My script is below.
jeff@R1# run op add-sub ?
error: ^
error: error: /var/db/scripts/op/add-sub.slax: 1 error detected during parsing
error: error reading stylesheet: add-sub.slax
Possible completions:
<[Enter]> Execute this command
<name> Argument name
detail Display detailed output
| Pipe through a command
/var/db/scripts/op/add-sub.slax:51: error: /var/db/scripts/op/add-sub.slax:50: parse error, unexpected T_VAR, expecting L_EOS or L_UNDERSCORE before '$math-type':
==========
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";
/* These variables defines the CLI help text */
var $arguments = {
<argument> {
<name> "oper";
<description> "Math operator";
}
<argument> {
<name> "num1";
<description> "First number";
}
<argument> {
<name> "num2";
<description> "Second number";
}
}
/* Command line arguments */
param $oper;
param $num1;
param $num2;
match / {
<op-script-results> {
var $math-type = {
if ( $oper == "+" ) {
expr $num1 + $num2;
}
else if ( $oper == "-" ) {
expr $num1 - $num2;
}
else {
expr "unknown";
}
}
/* Output */
<output> $user _ ": " $math-type;
}
}
05-25-2011 03:02 PM
05-26-2011 08:16 AM
Mattia, thank you for your reply.