Search code examples
shellcronsudo

Run a command with sudo in bash shell


How can i run a command in shell script with sudo? This script will be run by a cron job, so there should be no human intervention to enter a password manually.


Solution

  • echo 'password' | sudo -S command