Skip to content

Instantly share code, notes, and snippets.

@Maurifc
Last active November 19, 2022 13:19
Show Gist options
  • Save Maurifc/6f6a5916ec29ce2b847d61c25bab3b45 to your computer and use it in GitHub Desktop.
Save Maurifc/6f6a5916ec29ce2b847d61c25bab3b45 to your computer and use it in GitHub Desktop.
Bash - A boilerplate for a bash script
#!/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