BASH:
#!/bin/bash if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi
PERL:
#!/usr/bin/env perl if (0 == $> || 0 == $<) { # running by root } else { # not running by root }
若觀看本部落格造成您身體不適,請左轉出口離開,謝謝合作
BASH:
#!/bin/bash if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi
PERL:
#!/usr/bin/env perl if (0 == $> || 0 == $<) { # running by root } else { # not running by root }