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 | Peertube | Join Mastodon |
AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.