Shell script snippet to make sure your shell script runs as root
Clone or download
Pull request Compare This branch is even with neil-smithline-shellscripts:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Shell Utilities

This is a collection of various shell utilities that I’ve written throughout the years (actually decades but who’s counting). Everything I post has been written by me and credit is given where it is deserved and I remember. Apologies to anyone I’ve omitted.


This is a few lines of a shell script that you can source into your shell script to make sure it runs as root. It only works on Linux or other OSs that have a /proc filesystem (ie: no Mac OS X, no Cygwin).