A collection of common Bash functions and variables
At the top of the script:
## bash-fx
if [ -f "/usr/local/turbolab.it/bash-fx/bash-fx.sh" ]; then
source "/usr/local/turbolab.it/bash-fx/bash-fx.sh"
else
source <(curl -s https://raw.githubusercontent.com/TurboLabIt/bash-fx/main/bash-fx.sh)
fi
## bash-fx is ready
fxHeader "MY SCRIPT NAME"
rootCheck
In the project setup.sh
:
#!/usr/bin/env bash
echo ""
SCRIPT_NAME=sample-script-name
## bash-fx
if [ -z "$(command -v curl)" ]; then
sudo apt update && sudo apt install curl -y
fi
curl -s https://raw.githubusercontent.com/TurboLabIt/bash-fx/master/setup.sh?$(date +%s) | sudo bash
source /usr/local/turbolab.it/bash-fx/bash-fx.sh
## bash-fx is ready
sudo bash /usr/local/turbolab.it/bash-fx/setup/begin.sh ${SCRIPT_NAME}
## Symlink (globally-available zzfirewall command)
if [ ! -f "/usr/local/bin/${SCRIPT_NAME}" ]; then
ln -s ${INSTALL_DIR}${SCRIPT_NAME}.sh /usr/local/bin/${SCRIPT_NAME}
fi
## ... other stuff ...
sudo bash /usr/local/turbolab.it/bash-fx/setup/end.sh ${SCRIPT_NAME}