Skip to content

Commit eb2ae09

Browse files
author
NerdOfCode
committed
Added sudo checker
1 parent 8aa85e0 commit eb2ae09

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Bash/functions/is_root.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
#Purpose: Tell if the user is running script via root or not
3+
#If script exits with exit status of 2 then no root
4+
#If zero then root
5+
6+
7+
if [ "$EUID" -ne 0 ]
8+
then
9+
exit 2
10+
fi
11+
12+
exit 0

0 commit comments

Comments
 (0)