Quote:
Originally Posted by dave123
Yes thats what i do more or less, but what i want is if not root then to ask for root password (enter root pass) then carry on with the script .
|
Eh
if [ $(whoami) != "root" ] ; then
command
else
su root -c command
fi
the su will ask for a password.
it would be a better idea to use sudo:
if [ $(whoami) != "root" ] ; then
/path/to/command
else
sudo /path/to/command
fi
sudo will ask for the password..