Trying to send a "-" minus sign through exp_send
Posted by DBrocade (DBrocade), 16 November 2005Hi, I'm new here. Thanks in advance for all responses.
I am writing a script to automate the interaction wtih a power tower's command interface. This command interface is interactive not like a shell, but one you simply press numbers or symbols or move arrows around.
I telnet into the power tower andeverything works fine, i am able to interact with the command interface, go to the port i want to go to,. However, once at the port i want to power cycle i am supposed to hit a "-" on the keyboard.
So I try this exp_send "-" .. doesn't work.. I try all kinds of wrappers around the minus sign like single quotes, double quotes, no quotes, curly brace. I also tried using the octal representation of the minus sign.
sometimes it doesn't do anything, sometimes it says "ambiguous flag error, should be --, etc..."
It never works though.
Any ideas for what I could do?
When manually in the power tower, pressing "-" key works fine, but somehow when i use expect to send it, it jsut doesn't work.
my script looks like this
telnet into the power tower
exp_send "1" # one takes you to the power cycle menu
exp_send "2" #highlights port 2 on the interactive menu
exp_send "-" turn off the port highlighted, which is port2
and i have tried longer sleeps too.
I appreciate any help. thanks!
Posted by admin (Graham Ellis), 17 November 2005You list a lot of things, but have you tried
exp_send -- -
The use of parameters that are (or start with) a - sign is a problem with many Tcl commands as they look like options, and quotes, braces and all the rest can't help you as they're stripped off before the command itself gets the parameter. So if there's s problem with a command, the author will have provided an extra option - "--" - which is the option to end all options.
In other words, the -- option does nothing in itself, except it tells the command that the following things that might look like options are really parameters.
I've checked the manual, and send DOES support --.
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho