Bash - script to encrypt pdf files using pdfencrypt
Usability

Typing filenames on standard input is extremely annoying.
It would be better if the script took the input filename as command line argument.
That way users can benefit from path completion in the shell.

Simplify

Instead of this:


 while true; do
     echo "please select Pdf input file:"
     read -e -r infile
     if file --mime-type "$infile" | grep -q pdf$; then
         echo
         break
     else
         printf "\nis not a PDF file :-(\n\n"
     fi
 done



I would eliminate the else statement, and also simplify the echo-ing:

 while true; do
     echo "please select Pdf input file:"
     read -e -r infile
     echo
     file --mime-type "$infile" | grep -q pdf$ &amp;&amp; break
     echo "is not a PDF file :-("
     echo
 done


Redundant exit

The exit at the end of the script is redundant, I suggest to remove it.