I have the following issue. I have a bash script that when executed asks the user what file they wish to encrypt. The script works fine, the issue is when there is spaces in the file name. I have tried the following
read -p "Enter file name ..." test;
openssl enc -e -aes256 -in "'$test'" -out $test.enc -k -pass:$PASS
I get the following error msg
enc: Cannot open input file 'd d', No such file or directory
This line works in the bash script and if run in terminal
openssl enc -e -aes256 -in 'd d' -out enc.enc -k -pass:$PASS
Could someone please point me in the right direction. Thank you
With OpenSSL 1.1.0f you should use -passin:
read -p "Enter file name ..." test;
openssl aes-256-cbc -in "$test" -out "$test".enc -k -passin pass:"$PASS"