I have the Linux script shown below. I can get it to return from the method decrypt nothing which I need to unzip a file. The method decrypt sends a string with the name of a zip file. Please give some advice. I mention that another methods it brings correctly the files.
m_mode_verbose=1
const_1="ceva"
val="valoare"
decrypt ()
{
PASSPHRASE="xxxx"
encrypted=$1
local decrypt1=`echo $encrypted | awk '{print substr($0,0,64)}'`
echo "$PASSPHRASE"|gpg --no-tty --batch --passphrase-fd 0 --quiet --yes --decrypt -o ${sspTransferDir}/${decrypt1} ${sspTransferDir}/${encrypted} 2> /dev/null
if [ $? -eq 0 ]
then
notify "pgp decrypt of file.pgp succeeded"
else
notify "pgp decrypt of file.pgp failed"
fi
# PASSPHRASE=”your passphrase used for PGP”
# echo "$PASSPHRASE"|gpg --no-tty --batch --passphras
#e-fd 0 --quiet --yes \
#–decrypt -o file.dat file.pgp 2> /dev/null
#if [ $? -eq 0 ]
#then
# echo "pgp decrypt of file.pgp succeeded"
#else
# echo "pgp decrypt of file.pgp failed"
#fi
# echo "testtest $decrypt1"
echo "valoare ="$decrypt1
val=$decrypt1
#eval $decrypt1
$CONST=$decrypt1
echo "local"$CONST
}
process_file()
{
f=$1
echo "Processing $f"
for encrypted in `cat $f`; do
echo "Name of the file: "$i
echo "Decrypted : " $decrypted
decrypted=$(decrypt ${encrypted}) #decrypted = decrypt(encrypted)
# decrypted=decrypt ${encrypted} ${decrypted} #decrypted = decrypt(encrypted)
echo "val ============== " $val
echo "Decrypted after method" $decrypted
unzip -o ${TransferDir}/${decrypted} -d ${ImportRoot}
echo "Path after unzip" $ImportRoot
#rm -f ${decrypted}
echo "After remove" $decrypted
path=${sspTransferDir}/${encrypted}
#rm -f ${sspTransferDir}/${encrypted}
echo "Path to remove" $path
echo "Const ="$CONST
done
}
#main
get_config;
file="output$lang.txt"
echo "file is $file"
get_file_list $file # fills $file with the list of encrypted files corresponding to language $language
process_file $file #process - decrypt,