2020-07-16
Just chuck this in at the start of a bash script and itโll ensure the rest of the script is run by the root user:
#!/usr/bin/env sh [ `whoami` = root ] || { sudo "$0" "$@"; exit $?; }
unix bash