# Ubuntu – Adding root privileges to a bash script

bash

I am in need of adding root privileges to a bash script which uses sudo; so that whenever we run the script from the terminal; irrespective of the fact that the user is root or not it should not prompt for password. Please help! Doing Run Bash Script as Root did not help.

The best solution would be use visudo (this tool was made for that and will avoid the exposition of root password), I suggest you to dig what are going wrong with that.
echo <password> | sudo -S some-script