I need that in the middle of a script in bash a line be executed as root, I have this code:
#!/bin/bash
...
EOF
if [[ $x = true ]] || [[ $y= "On" ]]; then
echo -e "0 8 * * * root " >> /etc/crontab
I need the echo written in the crontab by the root user, who has a password. Currently it does not write as it is executed by the ubuntu user. Thank you.