Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Router failing (operator error no doubt)

by kcott (Canon)
on Feb 15, 2013 at 04:14 UTC ( #1018837=note: print w/ replies, xml ) Need Help??

in reply to Router failing (operator error no doubt)

G'day rmagin,

Welcome to the monastery.

The message indicating a potential "runaway multi-line" is due to the chop() statement:

$ perl -ce 'chop ($status=\Q$snmpset $oid s $rtr.cfg\Q);' Substitution pattern not terminated at -e line 1.

\Q escape sequences are terminated with \E (not another \Q) and are applied to strings (i.e. they're not standalone operators):

$ perl -ce 'chop ($status="\Q$snmpset $oid s $rtr.cfg\E");' -e syntax OK

Take a look at quotemeta for a more complete description.

toolic may well be correct in suggesting you want `...` instead of \Q...\Q; however, you may also want to escape the ASCII non-"word" characters in the return value - something like this (untested) might do what you want:

$ perl -ce 'chop ($status = quotemeta(`$snmpset $oid s $rtr.cfg`));' -e syntax OK

-- Ken

Comment on Re: Router failing (operator error no doubt)
Select or Download Code
Replies are listed 'Best First'.
Re^2: Router failing (operator error no doubt)
by Anonymous Monk on Feb 15, 2013 at 14:20 UTC

    Thank you Ken! that looks like it worked. Now just getting cp: cannot stat `/home/cisco/bkup/storage/LATEST/*': No such file or directory Can't open /home/cisco/bkup/RTR_LIST file at line 29.

    This is no doubt because I have no file for it to run across so I can bang away at this...your explanation on the /Q and /E was right on the money and I tried your alt format and it runs clean on checks...thanks again for looking at it.

    After consideration I still think this is wrong way for me to go. I have stuff that won't download from snmp or mibs so I am going to search for a good perl/expect combo that I can use to telnet in get the prompts and send the downloads to a tftp server that i kick on and off

    Thank you both for the assist


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018837]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2015-10-13 09:00 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (297 votes), past polls