fixed unary exceptions and posix compatibilty

This commit is contained in:
panda 2017-03-07 10:38:01 +01:00
parent f139e3e55d
commit 51592ad78b

14
gnano Normal file → Executable file
View file

@ -30,12 +30,12 @@ if [ "$argument" = "" ]; then
fi
#OPTIONS:
if [ $option = "--list" ] || [ $option = "-l" ]; then
if [[ $option = "--list" ]] || [[ $option = "-l" ]]; then
echo "RECIPIENTS:"
gpg --batch --list-only --no-default-keyring --secret-keyring /dev/null $argument
exit 1
fi
if [ $option = "--help" ] || [ $option = "-h" ]; then
if [[ $option = "--help" ]] || [[ $option = "-h" ]]; then
echo "Usage: gnano [OPTIONS] FILE"
echo ""
echo "Option GNU long option Meaning"
@ -45,7 +45,7 @@ if [ $option = "--help" ] || [ $option = "-h" ]; then
echo "no options giving only a filename the program decyphers the file, edits it, and recyphers it with the correct recipients"
exit 1
fi
if [ $option = "--new" ] || [ $option = "-n" ]; then
if [[ $option = "--new" ]] || [[ $option = "-n" ]]; then
new=1
echo "STARTING CREATION OF NEW FILE:"
echo "your is the task to retrieve the keys or emails of the recipients, I can't do it"
@ -58,7 +58,7 @@ if [ $option = "--new" ] || [ $option = "-n" ]; then
fi
#LOOP FOR EXISTING FILE:
if [ "$new" -eq "0" ]; then
if [[ $new -eq "0" ]]; then
if [ ! -f $argument ]; then
echo "FILE NOT FOUND, EXITING"
exit 1
@ -73,7 +73,7 @@ if [ "$new" -eq "0" ]; then
recipients+="-r $recipient "
done <$tempfile
if [ "$recipients" = "" ]; then
if [[ $recipients = "" ]]; then
echo "ERROR retrieving recipients, known issue, retry!"
exit 1
fi
@ -82,7 +82,7 @@ if [ "$new" -eq "0" ]; then
fi
#LOOP OFR NEW FILE:
if [ "$new" -eq "1" ]; then
if [[ $new -eq "1" ]]; then
for newrcpt in $(echo $newrecipients | tr "," "\n")
do
recipients+="-r $newrcpt "
@ -96,4 +96,4 @@ if [ "$new" -eq "1" ]; then
fi
#clearing tempfile:
rm $tempfile
rm $tempfile