1

I want decrypt some gpg files, output into a file. But each time gpg ask password.

for i in *.gpg; do echo $i>>~/t; gpg -d --batch $i >>~/t; done 

I test --multifile and --batch, those not as my wish.

1 Answer 1

2

Several ways:

# gather the password into $P stty -echo; read -r P; stty echo; for i in *.gpg; do printf '%s\n' "$i" >> ~/t; printf '%s' | gpg -d --batch --passphrase-fd 0 "$i" >> ~/t; done # gather the password into $P stty -echo; read -r P; stty echo; for i in *.gpg; do printf '%s\n' "$i" >> ~/t; gpg -d --batch --passphrase "$P" "$i" >> ~/t; done d=$(mktemp -d) # gather the password into a file named `p` stty -echo; cat > "$d/p"; stty echo for i in *.gpg; do printf '%s\n' "$i" >> ~/t; gpg -d --batch --passphrase-file "$d/p" 0 "$i" >> ~/t; done rm -rf "$d" 
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.