[rancid] clogin with command file - special signs

Chris Gauthier cgauthier at mapscu.com
Wed Oct 31 15:51:29 UTC 2012


>-----Original Message-----
>From: Trix Farrar [mailto:trix at basement.net] 
>Sent: Wednesday, October 31, 2012 8:48 AM
>To: Chris Gauthier
>Subject: Re: [rancid] clogin with command file - special signs
>
>On Wed, Oct 31, 2012 at 08:36:33AM -0700, Chris Gauthier wrote:
>> 1) clogin -x "conf t ; snmp-server community rrr\!\@\$ooo RW my_acl; 
>> end; wr; q" device_name
>> 2) clogin -x 'conf t ; snmp-server community rrr!@$ooo RW my_acl; end; 
>> wr; q' device_name
>
>I haven't tested either, but I don't think either of your examples will work.  As I sent to OP, there are two levels of escaping that need to be done.  I belive the correct approach will be to combine both of your examples by using single quotes on the command line -- to keep the shell from catching the '@' and '$' (and backslashes) -- and backslash escaping the special characters to keep the Tcl interprater from seeing them before they can be passed to the device.  This
>yields:
>
>3) clogin -x 'conf t ; snmp-server community rrr\!\@\$ooo RW my_acl; end; wr; q' device_name
>
>

I did not even consider that the first time.  Escaping special characters is not one of my strong points in the shell.  I'm constantly having to tweak my grep strings for that very reason.  Also, please post to the list next time so everyone can benefit from the knowledge.  I know when you hit "Reply" that is not the default behavior, but the knowledge transfer is very useful.

Chris

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE
Attention: The information contained in this email and/or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies.


More information about the Rancid-discuss mailing list