This is my code for any file encryption and decryption. However this will work if the file (which user want to encrypt/decrypt) and this script are in the same directory. I want user should give its file's input with its path. I would appreciate your help!!
This is my code
#!/bin/bash
echo "This is a simple file encrypter and decrypter"
echo "Please choose what you want to do: "
choice="Encrypt Decrypt"
select option in $choice; do
if [ $REPLY = 1 ];
then
echo "You have selected Encryption"
echo "Please enter the file name"
read file;
gpg -c $file
echo "The file has been encrypted"
else
echo "You have selected Dcryption"
echo "Please enter the file name"
read file2;
gpg -d $file2
rm $file2
echo "The file has been decrypted"
fi
done