So I am writing a bash script which will decrypt a file so I what the syntax of the the command to be decrypt [file.jpg] So far this is my script :
openssl enc -d -aes-256-cbc -in file.jpg > file
echo "Please make sure you add the correct extension to
the file."
Spent a lot time trying to achieve my goal but it doest work so I would like some help. Like suppose the file name is movie.mov I should be able to decrypt it using decrypt movie.mov or any other file.
Arguments on bash script are received with $1 for first arg, $2 for second etc...
So your script should looks like
openssl enc -d -aes-256-cbc -in $1 > file
See here
You can access parameters inside a bash script using the variables $1, $2, $3. $1 is the first argument, $2 the second ...
If you run
decrypt file.jpg
You can access file.jpg in your bash script with following code:
openssl enc -d -aes-256-cbc -in $1 > file
echo "Please make sure you add the correct extension to the file."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With