0

On my Computer is a Cisco WS-C3550 connected to serial interface, I can connect with following Command to the Device:

cu -l /dev/cuau0 -s 9600

If I connected to the Device i send following command

show interface FastEthernet0/2

And the output of this command I want to use in a shell script to get some values, how can I do this? I use FreeBSD (pfsense 2.0.1) as operating system.

I try anything like

echo 'show interface FastEthernet0/2' > cu -l /dev/cuau0 -s 9600 > test.log

But this dosen't work. I get following error:

Ambiguous output redirect.

kockiren
  • 711
  • 1
  • 12
  • 33
  • 2
    could it be echo 'show interface FastEthernet0/2' | cu -l /dev/cuau0 -s 9600 > test.log – Stephane Rouberol Sep 24 '12 at 10:20
  • yes it works but now I can't exit from this console, when I insert this command there will be shown a command prompt. If I'am on cu terminal i cant exit with '~.' on a new line. Is it possible to give multiple commands to cu command? – kockiren Sep 24 '12 at 13:03

1 Answers1

1

Try:

echo -e 'show interface FastEthernet0/2\n~.' | cu -l /dev/cuau0 -s 9600 > test.log

~. drops the connection see http://www.freebsd.org/cgi/man.cgi?query=cu&sektion=1

Stephane Rouberol
  • 4,286
  • 19
  • 18
  • Thx for your answer, but this dosen't work, I will get the prompt after run that command and the content of test.log is 'Connected' – kockiren Sep 24 '12 at 13:39
  • See above comment. If I enter this command on prompt, there comes a command prompt in a new line and in the test.log file is following content: 'Connected' thats all – kockiren Sep 24 '12 at 14:02