Skip to main content
echo -> printf; quoted $i
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 266

Several ways:

# gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo -- "$i" >> ~/t; printf '%s' | gpg -d --batch --passphrase-fd 0 $i >> ~/t; done # gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo -- "$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 echo -- "$i" >> ~/t; gpg -d --batch --passphrase-file "$d/p" 0 $i >> ~/t; done rm -rf "$d" 
# 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" 

Several ways:

# gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo -- "$i" >> ~/t; printf '%s' | gpg -d --batch --passphrase-fd 0 $i >> ~/t; done # gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo -- "$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 echo -- "$i" >> ~/t; gpg -d --batch --passphrase-file "$d/p" 0 $i >> ~/t; done rm -rf "$d" 

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" 
marginal improvement for now; should use printf...
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 266

Several ways:

# gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo $i-- "$i" >> ~/t; printf '%s' | gpg -d --batch --passphrase-fd 0 $i >> ~/t; done # gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo $i-- "$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 echo $i-- "$i" >> ~/t; gpg -d --batch --passphrase-file "$d/p" 0 $i >> ~/t; done rm -rf "$d" 

Several ways:

# gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo $i >> ~/t; printf '%s' | gpg -d --batch --passphrase-fd 0 $i >> ~/t; done # gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo $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 echo $i >> ~/t; gpg -d --batch --passphrase-file "$d/p" 0 $i >> ~/t; done rm -rf "$d" 

Several ways:

# gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo -- "$i" >> ~/t; printf '%s' | gpg -d --batch --passphrase-fd 0 $i >> ~/t; done # gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo -- "$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 echo -- "$i" >> ~/t; gpg -d --batch --passphrase-file "$d/p" 0 $i >> ~/t; done rm -rf "$d" 
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 266

Several ways:

# gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo $i >> ~/t; printf '%s' | gpg -d --batch --passphrase-fd 0 $i >> ~/t; done # gather the password into $P stty -echo; read P; stty echo; for i in *.gpg; do echo $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 echo $i >> ~/t; gpg -d --batch --passphrase-file "$d/p" 0 $i >> ~/t; done rm -rf "$d"