Big Brother tells me that Bart Schaefer wrote:
> On Nov 7, 11:30am, Jack McKinney wrote:
> > Subject: for loop body works, but not when called from for loop...
> >
> > for i in $(find . -name \*.pgp | fgrep -v ring.pgp) ; do ;
> > echo $i ; pgp -fd -z "My passphrase" < $i |
> > gpg --passphrase-fd 3 --batch -c 3<<< "My passphrase" > ${i%pgp}gpg ; done
> >
> > When I run it, it echoes the first file it finds, and creates the .gpg
> > file (since it is stdout of one of the commands). However, the file never
> > gets any data in it. [...] the echo command echoes the correct filename
> > (./test.pgp), but it just hangs there.
>
> What version of zsh are we talking about?
3.1.2, as compiled by debian 2.1.
> Are you typing out that loop at a shell prompt, or is it in a script? If
> the latter, what else is in the script? When you run the non-loop trial,
> is everything the same except for the loop?
I am typing it at the prompt. When it doesn't work, I type ctrl-C
to get back to the prompt, and set i to the value of the first file. Then,
I use the line editor to back up to the for loop and remove the loop and
run it. It works fine, then.
What I ended up doing was to put the body into a script, and then
ran the for loop to call the script. This worked just fine. I never
retyped anything, it was all copy and paste.
> What happens if you run the loop version, and type control-D to send it an
> EOF when it seems hung?
Good question. I just set this up again and tried it, and nothing
happens. It does not appear to be waiting for stdin.
> Something must be waiting for input. I don't know exactly what, or whether
> it might have something to do with file descriptor 3.
It shouldn't, since it works fine outside the loop or inside a script
called by the loop.
--
"Restore your inalienable human rights. Jack McKinney
Vote Libertarian. http://www.lp.org http://www.lorentz.com
http://www.harrybrowne2000.org jackmc@xxxxxxxxxxx
1024D/D68F2C07 4096g/38AEF076
Attachment:
pgpfL8DT9jtHk.pgp
Description: PGP signature