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 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
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 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., 2022: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho