Cara membuat naskah bash harus dijalankan di sudo

if [[ $(/usr/bin/id -u) -ne 0 ]]; then
    echo "Not running as root"
    exit
fi
Adventurous Anteater