i'm attempting to write a bash script to automate a sublaunched apps'
interactive dialog.
fwiw, the app in question is gpg, in its key-revocation mode.
the 1st, simple task is to auto-respond to its 1st interactive
question with a 'Yes'; subsequent questions -- there are several --
will require
snowcrash+bugbash [EMAIL PROTECTED] wrote:
CMD=$GPG --output revoke.txt --gen-revoke $ME
/usr/bin/expect -c \
spawn `$CMD`;\
stty -echo;\
expect 'Create a revocation certificate for this key? (y/N) ';\
send 'y\n'
You have backticks around $CMD. That means bash will run the gpg
i wasn't even close! but, this works:
-
#!/usr/local/bin/bash
$GPG=sudo -u gpguser /usr/local/bin/gpg
$NAME=revoke.txt
$ADDR=[EMAIL PROTECTED]
VAR=$(expect -c
spawn $GPG --output $NAME --gen-revoke $ADDR
set timeout -1
stty -echo