Discussion:
[rancid] Cisco commands containing ';'...
Jon Peatfield
2009-09-16 17:01:54 UTC
Permalink
I may have been expecting too much but I wanted to run:

clogin -c 'conf t; boot system flash:bootimage1;flash:bootimage2; exit' a b c

to set the boot path on a set of identical switches. Of course clogin
splits the command at the ; in the middle of the boot system command so
that fails...

So I thought I need to use -x and pass a file with the lines but that also
fails because it seems that clogin actually joins the lines from the file
with ; and then treats is just as if it was a -c option (ie it splits it
at all ; again).

So is there a way to bypass the split and get a real ; into a command?

A glance through the code doesn't suggest anything obvious but I may be
missing a trick...
--
/--------------------------------------------------------------------\
| "Computers are different from telephones. Computers do not ring." |
| -- A. Tanenbaum, "Computer Networks", p. 32 |
---------------------------------------------------------------------|
| Jon Peatfield, _Computer_ Officer, DAMTP, University of Cambridge |
| Mail: ***@damtp.cam.ac.uk Web: http://www.damtp.cam.ac.uk/ |
\--------------------------------------------------------------------/
Ryan West
2009-09-16 17:37:35 UTC
Permalink
Have you tried an escape "\" ?

Not sure it would help, but worth a try.

-ryan

-----Original Message-----
From: rancid-discuss-***@shrubbery.net [mailto:rancid-discuss-***@shrubbery.net] On Behalf Of Jon Peatfield
Sent: Wednesday, September 16, 2009 1:02 PM
To: rancid-***@shrubbery.net
Subject: [rancid] Cisco commands containing ';'...

I may have been expecting too much but I wanted to run:

clogin -c 'conf t; boot system flash:bootimage1;flash:bootimage2; exit' a b c

to set the boot path on a set of identical switches. Of course clogin
splits the command at the ; in the middle of the boot system command so
that fails...

So I thought I need to use -x and pass a file with the lines but that also
fails because it seems that clogin actually joins the lines from the file
with ; and then treats is just as if it was a -c option (ie it splits it
at all ; again).

So is there a way to bypass the split and get a real ; into a command?

A glance through the code doesn't suggest anything obvious but I may be
missing a trick...
--
/--------------------------------------------------------------------\
| "Computers are different from telephones. Computers do not ring." |
| -- A. Tanenbaum, "Computer Networks", p. 32 |
---------------------------------------------------------------------|
| Jon Peatfield, _Computer_ Officer, DAMTP, University of Cambridge |
| Mail: ***@damtp.cam.ac.uk Web: http://www.damtp.cam.ac.uk/ |
\--------------------------------------------------------------------/
john heasley
2009-09-16 17:53:29 UTC
Permalink
Post by Ryan West
Have you tried an escape "\" ?
that will not work. We'd have to add logic to do that. I'd lean toward
doing that. one hack option would be to encode it as its ascii value;
59 or 0x3b. But, I dont recall off the top how to do that encoding for
tcl's printf (expect's send).
Post by Ryan West
Not sure it would help, but worth a try.
-ryan
-----Original Message-----
Sent: Wednesday, September 16, 2009 1:02 PM
Subject: [rancid] Cisco commands containing ';'...
clogin -c 'conf t; boot system flash:bootimage1;flash:bootimage2; exit' a b c
to set the boot path on a set of identical switches. Of course clogin
splits the command at the ; in the middle of the boot system command so
that fails...
So I thought I need to use -x and pass a file with the lines but that also
fails because it seems that clogin actually joins the lines from the file
with ; and then treats is just as if it was a -c option (ie it splits it
at all ; again).
So is there a way to bypass the split and get a real ; into a command?
A glance through the code doesn't suggest anything obvious but I may be
missing a trick...
--
/--------------------------------------------------------------------\
| "Computers are different from telephones. Computers do not ring." |
| -- A. Tanenbaum, "Computer Networks", p. 32 |
---------------------------------------------------------------------|
| Jon Peatfield, _Computer_ Officer, DAMTP, University of Cambridge |
\--------------------------------------------------------------------/
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Jon Peatfield
2009-09-16 17:57:49 UTC
Permalink
Post by john heasley
Post by Ryan West
Have you tried an escape "\" ?
that will not work. We'd have to add logic to do that. I'd lean toward
doing that. one hack option would be to encode it as its ascii value;
59 or 0x3b. But, I dont recall off the top how to do that encoding for
tcl's printf (expect's send).
It works if I put \073 instead of ; e.g

clogin -x filename ...

where filename contains:

conf t
boot system
flash:bootimage1\073flash:bootimage2
exit

ie putting \073 where I want the ;...

Excellent!

Many thanks.

-- Jon

Loading...