Bash scripting 9 – check for root
Some tasks require the user to have root or admin permissions in order for the task to be completed successfully. There are several ways to do this, some are detailed on AskUbuntu
if ((${EUID:-0} || "$(id -u)")); then
echo You are not root.
else
echo Hello, root.
fi
Tags
#Bash,#Bashscripting,#BatchProcessing,#CheckRoot
| Mastodon | ShellLabs | Join Mastodon |