Add nice pre-made functions to your bash scripts
- Add these lines at the beginning of your code, after setting your basic variables :
# Download bash API
if [ ! -f "ultimate-bash-api.sh" ]; then
wget https://raw.githubusercontent.com/UltimateByte/ultimate-bash-api/master/ultimate-bash-api.sh
chmod +x ultimate-bash-api.sh
fi
source ultimate-bash-api.sh
- Enjoy using functions in your code
Will echo your text with a nice form
Will echo your text with a nice form to the log file
After defining the "mailsubject" and "mailcontent" vars, will send a mail to the contact email set into the API (mailto_address)
Will send the latest log to the given address
Will output the past duration since the api was sourced (typically in the early moments of your script)