Last active
November 19, 2022 13:19
-
-
Save Maurifc/6f6a5916ec29ce2b847d61c25bab3b45 to your computer and use it in GitHub Desktop.
Bash - A boilerplate for a bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ACTION=$1 | |
function help(){ | |
echo -e \ | |
"Usage: | |
1. Export ESSENTIAL_VARIABLE varible with... | |
$ export ESSENTIAL_VARIABLE=<KEY_PATH> | |
2. Encrypt or decrypt your files | |
Encrypt all .dec.yaml files | |
$ ./secret --encrypt | |
Decrypt all .enc.yaml files | |
$ ./secret --decrypt" | |
} | |
if [ -z $ESSENTIAL_VARIABLE ] | |
then | |
echo "Failure. You need to export ESSENTIAL_VARIABLE variable before proceed" | |
exit 1 | |
fi | |
case "$ACTION" in | |
"--encrypt") | |
echo "Encrypting..." | |
;; | |
"--decrypt") | |
echo "Decrypting..." | |
;; | |
*) | |
echo -e "Error: Command $ACTION not found!!! \n" | |
help | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment