I am trying to figure out how to pass a command-line argument into an expect
script.

For example, suppose I have a script called update.exp.  The first few lines
of update.exp are as follows: 

        #!/usr/bin/expect

        spawn $env(SHELL)
        expect "$ "
        send -- "telnet node$1\r"
        expect "login: "
        ...etc.

I want to be able to execute the script from the command line with a single
argument, and then use that argument as variable $1 in the script.  So if I
do this:

$./update.exp 123

the script will telnet to node123.

The man pages suggest that this might be possible, but I haven't been able
to make it work.  If it matters, I'm using expect version 5.28.1.

Any help would be appreciated.

Rick Teudt



_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to