zsh-users
 help / color / mirror / code / Atom feed
From: "Jack McKinney" <jackmc-zsh-users@lorentz.com>
To: zsh-users@sunsite.auc.dk
Subject: for loop body works, but not when called from for loop...
Date: Tue, 7 Nov 2000 11:30:47 -0600	[thread overview]
Message-ID: <20001107113047.A32446@stocks.pillory.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

    You shouldn't need to know PGP or GPG for this.  The commands being
used here are just a filter: a pipeline copying stdin to stdout, but changing
it on the way.

    I have a bunch of PGP files that I want to convert to GPG.  Here is
the for loop I am using:

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.  My first instinct is that I have the commands inside
the loop wrong.  So, I set i to this first file, and run just the body:

i=./test.pgp
pgp -fd -z "My passphrase" < $i | gpg --passphrase-fd 3 --batch -c 3<<< "My passphrase" > ${i%pgp}gpg

    Poof, the command executes in less than a second, and produces the
correct output file.  Since I actually run this command outside the loop
with $i in it, I know for certain that I have the body correct.  However,
when I run the loop version, the echo command echoes the correct filename
(./test.pgp), but it just hangs there.  The output file gets created by
the shell, but the pipeline never puts any data into it.

    Why would a for loop's body execute just fine on it own, but not when
called from the loop?

--
"Restore your inalienable human rights.       Jack McKinney
 Vote Libertarian.  http://www.lp.org         http://www.lorentz.com
 http://www.harrybrowne2000.org               jackmc@lorentz.com
                                              1024D/D68F2C07 4096g/38AEF076

[-- Attachment #2: Type: application/pgp-signature, Size: 240 bytes --]

             reply	other threads:[~2000-11-07 17:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-07 17:30 Jack McKinney [this message]
2000-11-07 19:38 ` Bart Schaefer
2000-11-07 19:44   ` Jack McKinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20001107113047.A32446@stocks.pillory.com \
    --to=jackmc-zsh-users@lorentz.com \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).