From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96075323306745.tru64-unix-managers.marc@archive.invalid> From: Neil Movold Date: Thu, 28 Sep 1995 00:08:44 +0000 To: tru64-unix-managers Subject: Calling tcl/expect script from Perl with arguements? X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96075323306745 I have recently picked up TCL/Expect for the purpose of writing a script to answer the questions asked by the system "adduser" script. As it turns out, the passwd command under OSF/1 is very picky about receiving its input from ttys. The expect script I wrote, from some examples that came with the source, works great when called from the shell prompt. However, when I call the same script from within a Perl script, it causes errors. The following is the small Perl script I used to test this out : ---------------------- #!/usr/local/bin/perl # @proglist = ("./create_account.exp","jdoe","WILLLY","The Wilster"); $rc = system(@proglist); print("rc = $rc\n"); --------------------- Here is the top part of my Expect script that works fine from the shell prompt : -------------------- #!/usr/local/bin/expect # log_user 1 # stop STDOUT messages set user [lindex $argv 0] # New userid set password [lindex $argv 1] # New password set name [lindex $argv 2] # New user full name # set user [string index $argv 0] # New userid # set password [string index $argv 1] # New password # set name [string index $argv 2] # New user full name # spawn /usr/sbin/adduser # spawn off the adduser script expect "new user" --------------------- I tried two approaches which both failed. When I run the Perl script, I get the following error message : --------------------- wrong # args: should be "set varName ?newValue?" while executing "set user [lindex $argv 0] # New userid" (file "./create_account.exp" line 14) rc = 256 -------------------- What does this mean? Unfortunately, I have no reference material to fall back on. I have ordered a couple of books on tcl and expect, but it will take a few weeks for them to be delivered over seas from the US. I have looked on the Web and cannot find anything matching this problem. Any advice would be appreciated. Neil :-) \\\// (o o) ------------------ooO-(_)-Ooo----------------------------------------- Neil Movold Phone : +1 809 296-1800 Special Operations Consultant Fax : +1 809 295-7269 ( i.e. the guy who has to make it all work :-) ) Internet (Bermuda) Limited E-mail : nmovold@ibl.bm P.O. Box HM2445 Hamilton, Bermuda HM JX