Files
bash_utils/need-root.sh
2024-03-22 07:02:10 +01:00

14 lines
191 B
Bash

#!/bin/bash
if ! [ $(id -u) = 0 ]; then
echo "The script needs to be run as root." >&2
exit 1
fi
if [ $SUDO_USER ]; then
real_user=$SUDO_USER
else
real_user=$(whoami)
fi