Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using "exec" in Expect scripts to call external programs

1,289 views
Skip to first unread message

scottdware

unread,
Jan 29, 2009, 1:24:58 PM1/29/09
to
I am having some issues using the exec command within my Expect
scripts. Basically, what I want to do is just call "cat" or "grep" on
another file but when I put it in the code, it doesn't seem to work.
Keeps saying that "command is not found."

Can anyone help me out possibly with some examples of a good working
way to accomplish this?

Thanks in advance!

Bezoar

unread,
Jan 29, 2009, 1:38:40 PM1/29/09
to

Could be a number of things but without some code it is hard to tell
what it is for sure. Are you
getting as the return to an exec call the "command not found" message
or does this show up in the terminal when you try to run your expect
script? If the latter then check your PATH environment variable to
make sure it includes the directory for cat and grep and whatever else
you may be calling; if the former, then make sure the expect
interpreter is reachable via your PATH. Exec may act like the system
call on Unix and may invoke sh to run the commands given to it. Check
to make sure that sh is available also via the path. If all else fails
post some code to get better response.

Carl

Cameron Laird

unread,
Jan 29, 2009, 2:30:28 PM1/29/09
to
In article <c36896ff-e989-49c3...@l39g2000yqn.googlegroups.com>,

It's easy to speculate that you have written

set contents [exec "cat $myfile"]

rather than

set contents [exec cat $myfile]

0 new messages