My knowledge of Linux is on the pre-school level and most of the answers I've found here - it didn't answer my problem.
I want to automate my everyday job and put the process of logging into the root user, doing some lines and logging out. E.g.
#!/usr/bin/bash
cd /
su -
echo "my_password"
Here is a problem I need to confirm the password by pressing the ENTER key
doing something as rootlogout
I tried:
echo "my_password" | su
But it didn't help and also tried
su - echo "my_password\n"
It didn't help either and also tried
su - echo -e "my_password\n"
It was wrong and also tried
su - echo "my_password" bind '\C-m'
It was wrong either. What is the easiest way to do that? Thanks,