20090603

bash trick start as root when user != root

  3 main () {
  4 if [[ "$(whoami)" != 'root' || "$(id -u)" != 0 ]]; then
  5    echo -e "Please give your user passwd, prog needs to run as root" ARH
  6    /usr/bin/sudo $0  7 else

No comments:

Post a Comment