You are not logged in.
I wrote a simple shell function,
decrypt () {
for i in "$@"; do
if [ -d "$i" ]; then
gpg -d "$i" | tar xzf -
# srm "$i"
elif [ -f "$i" ]; then
gpg -o ${i%.gpg} -d "$i"
srm "$i"
else
echo "$i" is not a valid file or directory.
fi
done
}
I can pass it a list of files that I have encrypted with an encrypt() function: regular files just get gpg'd, and folders get tarred first.
Decrypting files works fine, but decrypting a folder does not. Why?
Addendum:
I can run the following line in an interactive shell:
gpg -d test\ directory.tgz.gpg | tar xzf -
This works fine. I get a directory called "test directory".
However, running
decrypt test\ directory.tgz.gpg
(which is the file that my encrypt() function produces) doesn't work, I just get a file "test directory.tgz", as though tar was never invoked.
I can't figure out why, but I'm sure it's something simple.
Offline
Does changing
gpg -o ${i%.gpg} -d "$i"
to
gpg -o "${i%.gpg}" -d "$i"
have any effect?
Offline
Aha! I'm an idiot.
I wrote an encryption folder to check for whether the input is a file or folder, and tar any folder first.
Of course, the decryption folder will only ever be acting on files, some of which just happen to be directories originally.
Offline