On 04/30/2014 10:38 AM, Jeffrey Anderson wrote:
It seems to me that having a shell script prompt for the root password
is a recipe for disaster, but you can easily check to see if the user is
already root, and bail if not.


That is what I currently do.  I am just wanting to get fancy:

if [ -z "`/usr/bin/whoami | grep root`" ]; then
   echo ""
   # ErrorSound
   echo 'Dude!  You must be root to do this.'
   echo "Try"
   echo "    su root -c \"updateffth $1\""
   echo 'Exiting.   Bummer ...'
   echo ""
   Pause
   exit 1
fi

Reply via email to