So, this is my first attempt at writing a shell script.
Do I have the syntax correct?
Do I need to do anything other than save it as a .txt file?
I intend to trigger it with a shortcut manager such as Keyboard Maestro, iKey or Spark.
Do I have the syntax correct?
Do I need to do anything other than save it as a .txt file?
I intend to trigger it with a shortcut manager such as Keyboard Maestro, iKey or Spark.
Code:
#!/bin/bash
# a script to increase the security of a particular file before it is manually uploaded to a cloud storage
# service by encrypting it with openssl symetric encryption.
# remove the existing file, we don't need to keep past versions of the file.
rm -rf /Users/myusername/path/to/folder/file
# wait a moment
sleep 1
# openssl commands to encrypt the file and place it in the desired folder. The same folder that we
# cleared out in step one. We use a passphrase specified on the first line of password.txt
# For our purposes it is ok to have the password stored in a plaintext file locally.
openssl enc -aes-128-cbc -salt -in Users/myusernmae/path/to/the/filetoencrypt -out /Users/myusername/path/to/file -pass file:/Users/myusername/path/to/secret/password.txt