Bash: check for root
Check to see if script is running as root…
#!/bin/bash
if [ `id -u` != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi
Check to see if script is running as root…
#!/bin/bash
if [ `id -u` != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi