[j-nsp] Is it possible to pass apostrophe character(ASCII dec code 39) as an argument value to SLAX script?

Nathan Ward juniper-nsp at daork.net
Thu Jul 12 04:29:08 EDT 2018


I thought I had it by being cunning, but, no!

{master}
nward at mx> op test chr \x27
''':(null):(2) Invalid expression
error: runtime error
error: Evaluating user parameter chr failed

{master}
nward at mx> op test chr \\x27
'\'':(null):(3) Invalid expression
error: runtime error
error: Evaluating user parameter chr failed

:-(

> On 12/07/2018, at 8:00 PM, Martin T <m4rtntns at gmail.com> wrote:
> 
> Hi!
> 
> Is it possible to pass apostrophe character(ASCII dec code 39) as an
> argument value to SLAX script? I have tried to escape it, but it does
> not seem to work:
> 
> root at vmx1> op test chr '
> ''':(null):(2) Invalid expression
> error: runtime error
> error: Evaluating user parameter chr failed
> 
> root at vmx1> op test chr "'"
> ''':(null):(2) Invalid expression
> error: runtime error
> error: Evaluating user parameter chr failed
> 
> root at vmx1> op test chr \'
> '\'':(null):(3) Invalid expression
> error: runtime error
> error: Evaluating user parameter chr failed
> 
> root at vmx1> op test chr '''
> ''''':(null):(2) Invalid expression
> error: runtime error
> error: Evaluating user parameter chr failed
> 
> root at vmx1>
> 
> 
> Script named test is following:
> 
> root at vmx1> file show /var/db/scripts/op/test.slax
> version 1.1;
> 
> 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";
> 
> var $arguments = {
>        <argument> {
>                <name> "chr";
>        }
> }
> 
> param $chr;
> 
> match / {
>        <op-script-results> {
>                <output> "Character: " _ "'" _ $chr _ "'";
>        }
> }
> 
> root at vmx1>
> 
> I guess it is not possible and one needs to use get-input() function?
> 
> 
> thanks,
> Martin
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp



More information about the juniper-nsp mailing list