Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Trying to send a "-" minus sign through exp_send

Posted by DBrocade (DBrocade), 16 November 2005
Hi, 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
sleep 4
exp_send "2" #highlights port 2 on the interactive menu
sleep 4
exp_send "-" turn off the port highlighted, which is port2

... etc



and i have tried longer sleeps too.

I appreciate any help. thanks!


Posted by admin (Graham Ellis), 17 November 2005
You 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 --.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho