Skip to content

Instantly share code, notes, and snippets.

@4piu
Created November 1, 2021 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4piu/ef7a9a170bc4a0127c32bbb2280cdf7e to your computer and use it in GitHub Desktop.
Save 4piu/ef7a9a170bc4a0127c32bbb2280cdf7e to your computer and use it in GitHub Desktop.
Check root permission in sh
#!/usr/bin/env sh
if [ "$(id -u)" != "0" ]; then
echo "Please run as root"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment