[rancid] clogin with command file - special signs

Trix Farrar trix at basement.net
Wed Oct 31 15:56:28 UTC 2012


On Wed, Oct 31, 2012 at 08:36:33AM -0700, Chris Gauthier wrote:
> I believe you can escape those characters or put them inside a
> single-quote to make it a more literal translation.  I have given
> examples of both below.  I think that option 1 will probably work
> better, but don't hold me to that.
> 
> 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                    
  
(reposted to the list, by request)                                                                                                              

-- 
John D. "Trix" Farrar            __\\|//__               Basement.NET
trix at basement.net                (` o-o ')   http://www.basement.net/
--------------------------------ooO-(_)-Ooo--------------------------
 GPG Key Fprint: 525F DBA7 1A62 E4C4 E642  DF95 384B B851 3CEF C10A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20121031/496ed532/attachment-0001.bin>


More information about the Rancid-discuss mailing list