How to pass argument in Expect through the command line in a shell script
I like the answer provided with this guide.
It creates a parse argument process.
#process to parse command line arguments into OPTS arrayproc parseargs {argc argv} { global OPTS foreach {key val} $argv { switch -exact -- $key { "-username" { set OPTS(username) $val } "-password" { set OPTS(password) $val } } }}parseargs $argc $argv#print out parsed username and password argumentsputs -nonewline "username: $OPTS(username) password: $OPTS(password)"
The above is just a snippet. It's important to read through the guide in full and add sufficient user argument checks.