Script which will login to particular user and execute some commands.
Hi All,
I am trying to write one script. Purpose of my script is that it will login to particular user and it will execute some set of commands.
What I was trying....
#!/bin/bash
su - tom
ls -lrt
gzip *.dbf
but it is not working properly. what happening is I am getting the shell of user tom but but commands are not getting executed.
I am running this script as root user. what should I have to do if I wanted to run this script as normal user. I want to pass the password in the script only. (--stdin will work)
|