Simple expect script has erratic behavior, why?
From: Geoff (geoff_hazel_at_yahoo.com)
Date: 07/22/04
- Next message: Bob Techentin: "Re: ANNOUNCE: Tcl Stubs Package"
- Previous message: Robert Seeger: "Re: ANNOUNCE: Tcl Stubs Package"
- Next in thread: Don Libes: "Re: Simple expect script has erratic behavior, why?"
- Reply: Don Libes: "Re: Simple expect script has erratic behavior, why?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Jul 2004 09:58:10 -0700
I have a simple expect script to decrypt a gpg file when passed the
passphrase on the command line. Yet, when I execute it, sometimes it
works, sometimes it doesn't. When it works, I get output. When it
doesn't, it sits there like it's waiting for something, and then exits
without the desired output. It can fail three times and then work.
What is going on??? This is my first "expect" script, I'm trying to
automate a decrypt/encrypt process that I have to run weekly. If I
can get this little script to work, I'm home free.
Here's the script: (expect.test)
#!/usr/bin/expect
spawn gpg --decrypt crap.gpg
set password1 [lindex $argv 0]
expect "*passphrase:"
send "$password1\r"
expect eof
When I run it a few times, here's what I get:
ghazel@dmtl001 [/home/ghazel]
=> ./expect.test crap | grep -v gpg
Enter passphrase: crap
ghazel@dmtl001 [/home/ghazel]
=> ./expect.test crap | grep -v gpg
Enter passphrase: crap
ghazel@dmtl001 [/home/ghazel]
=> ./expect.test crap | grep -v gpg
Enter passphrase: crap
hi,geoff,you,rock
hi,zach,you,rock2
If I run the gpg command from the command line, of course it prompts
for the password, but it runs over and over without any hitch or
glitch I can detect.
Replies to geoffreyhazel@yahoo.com or this group.
- Next message: Bob Techentin: "Re: ANNOUNCE: Tcl Stubs Package"
- Previous message: Robert Seeger: "Re: ANNOUNCE: Tcl Stubs Package"
- Next in thread: Don Libes: "Re: Simple expect script has erratic behavior, why?"
- Reply: Don Libes: "Re: Simple expect script has erratic behavior, why?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|