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.

2
  • 2
    could it be echo 'show interface FastEthernet0/2' | cu -l /dev/cuau0 -s 9600 > test.log Commented Sep 24, 2012 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? Commented Sep 24, 2012 at 13:03

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

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'
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.