########
Perhaps someone out there could assist?
I am having an issue using my script. It works fine when I feed it an inline argument, but NOT when I get the argument from a list and pass it as a variable.
WORKS: "Scriptname encr1": I put the filename to encrypt as an arg to this script.
It then passes to my expect script which encrypts just fine. (using openssl) #FILENAME="${1%}"
#encrit.exp "$FILENAME" "$FILENAME.enc"
NOT WORKING:"enc2-lab" I read filename from a list using a while loop.
It then pass this to that same working expect encryption script.
But, in this case, it produces an empty zero byte filename.enc file.
#while read -r line;
#do
#encrit.exp "${line}" "${line}.enc"
----
WORKING:
Dell$ encr1 blah.pdf
USAGE: $>encr1 filename-to-encrypt
The filename to encrypt is "blah.pdf"
blah.pdf exists
spawn openssl enc -iter 1000 -salt -aes-256-cbc -in blah.pdf -out blah.pdf.enc
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
ENCRYPTON PERFORMED! (blah.pdf.enc has been Created and is 75999 bytes)
-----
NOT WORKING: (scriptname enc2-lab): This script gathers the argument from a file and then uses it to run the above command.
#encrit.exp "$file" "$file.enc" #This way only works on the 1st loop, enc files are 0 bytes
The above command seems to process it, but then we end up with a zero byte empty file.?
Dell$ enc2-lab
--Current line is /mnt/c/TMP/blah.pdf ---
Line 1 is This is a file ( "/mnt/c/TMP/blah.pdf" )
ENCRYPTING FILE. /mnt/c/TMP/blah.pdf
spawn openssl enc -iter 1000 -salt -aes-256-cbc -in blah.pdf -out blah.pdf.enc
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
ENCRYPTON PERFORMED! (blah.pdf.enc has been Created and is 0 bytes)
Note that the above output is a useless empty file.
----
thanks,
crzzy1
#########
########
Perhaps someone out there could assist?
I am having an issue using my script. It works fine when I feed it an inline argument, but NOT when I get the argument from a list and pass it as a variable.
WORKS: "Scriptname encr1": I put the filename to encrypt as an arg to this script.
It then passes to my expect script which encrypts just fine. (using openssl) #FILENAME="${1%}"
#encrit.exp "$FILENAME" "$FILENAME.enc"
NOT WORKING:"enc2-lab" I read filename from a list using a while loop.
It then pass this to that same working expect encryption script.
But, in this case, it produces an empty zero byte filename.enc file.
#while read -r line;
#do
#encrit.exp "${line}" "${line}.enc"
----
WORKING:
Dell$ encr1 blah.pdf
USAGE: $>encr1 filename-to-encrypt
The filename to encrypt is "blah.pdf"
blah.pdf exists
spawn openssl enc -iter 1000 -salt -aes-256-cbc -in blah.pdf -out blah.pdf.enc
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
ENCRYPTON PERFORMED! (blah.pdf.enc has been Created and is 75999 bytes)
-----
NOT WORKING: (scriptname enc2-lab): This script gathers the argument from a file and then uses it to run the above command.
#encrit.exp "$file" "$file.enc" #This way only works on the 1st loop, enc files are 0 bytes
The above command seems to process it, but then we end up with a zero byte empty file.?
Dell$ enc2-lab
--Current line is /mnt/c/TMP/blah.pdf ---
Line 1 is This is a file ( "/mnt/c/TMP/blah.pdf" )
ENCRYPTING FILE. /mnt/c/TMP/blah.pdf
spawn openssl enc -iter 1000 -salt -aes-256-cbc -in blah.pdf -out blah.pdf.enc
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
ENCRYPTON PERFORMED! (blah.pdf.enc has been Created and is 0 bytes)
Note that the above output is a useless empty file.
----
thanks,
crzzy1
#########
On 3/21/2022 1:08 PM, Chris Roberts wrote:
########Copy/paste your code into http://shellcheck.net, fix the issues it tells
Perhaps someone out there could assist?
you about, and then if you still have a problem post that corrected
script you want help with here.
Ed.
I am having an issue using my script. It works fine when I feed it an inline argument, but NOT when I get the argument from a list and pass it as a variable.
WORKS: "Scriptname encr1": I put the filename to encrypt as an arg to this script.
It then passes to my expect script which encrypts just fine. (using openssl)
#FILENAME="${1%}"
#encrit.exp "$FILENAME" "$FILENAME.enc"
NOT WORKING:"enc2-lab" I read filename from a list using a while loop.
It then pass this to that same working expect encryption script.
But, in this case, it produces an empty zero byte filename.enc file.
#while read -r line;
#do
#encrit.exp "${line}" "${line}.enc"
----
WORKING:
Dell$ encr1 blah.pdf
USAGE: $>encr1 filename-to-encrypt
The filename to encrypt is "blah.pdf"
blah.pdf exists
spawn openssl enc -iter 1000 -salt -aes-256-cbc -in blah.pdf -out blah.pdf.enc
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
ENCRYPTON PERFORMED! (blah.pdf.enc has been Created and is 75999 bytes) -----
NOT WORKING: (scriptname enc2-lab): This script gathers the argument from a file and then uses it to run the above command.
#encrit.exp "$file" "$file.enc" #This way only works on the 1st loop, enc files are 0 bytes
The above command seems to process it, but then we end up with a zero byte empty file.?
Dell$ enc2-lab
--Current line is /mnt/c/TMP/blah.pdf ---
Line 1 is This is a file ( "/mnt/c/TMP/blah.pdf" )
ENCRYPTING FILE. /mnt/c/TMP/blah.pdf
spawn openssl enc -iter 1000 -salt -aes-256-cbc -in blah.pdf -out blah.pdf.enc
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
ENCRYPTON PERFORMED! (blah.pdf.enc has been Created and is 0 bytes)
Note that the above output is a useless empty file.
----
thanks,
crzzy1
#########
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (0 / 16) |
| Uptime: | 161:31:28 |
| Calls: | 12,094 |
| Calls today: | 2 |
| Files: | 15,000 |
| Messages: | 6,517,775 |