1)
Environment:Red Hat Linux, bash shell
Script to be run owned by user :myUser
Home environment of myUser: pathto/home
2) ESP agent with root access will run
JobXXX.sh
su - myUser -c "/pathto/home/bin/script.sh"
where script.sh has some echo statements and an exit statement in the end
Current behaviour when running the script:
root@ServerName1>./JobXXX.sh
(and then the control remains on the following path)
myUser@Servername1[pathto/home]
(have to print "exit" to get the output of echo statements and ctrl back to root@ServerName1
Expected behaviour when running the script:
root@ServerName1>./JobXXX.sh
- Runs /pathto/home/bin/script.sh
- Prints the echo statements
- ctrl is root@ServerName1
Any suggestions how to fix the issue ?
Thanks for help.