Exit bash script if not running as root code example
Example: Exit bash script if not running as root
[[ $EUID -ne 0 ]] && echo "This script must be run as root." && exit 1
[[ $EUID -ne 0 ]] && echo "This script must be run as root." && exit 1