#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "I am not root."
else
echo "I am root."
fi
NOTE: EUID is not available in standard POSIX shell /bin/sh. You will have to use /bin/bash if you want to use EUID in your script. See also this article.
No comments:
Post a Comment