Programming Snippets
Tuesday, August 11, 2015
Check Root User
#--------------------------
# c h e c k _ r o o t
#--------------------------
# Checks that the current user is "root" else exit.
check_root()
{
if [ "$(/usr/ucb/whoami)" != "root" ]; then
echo "\007You must be root to run this script!"
exit 1
fi
}
Reading Input from user
Examples: while loop, ask input, read input,
Newer Posts
Home
Subscribe to:
Posts (Atom)