I have written a script to automate a software install. I am running the script as root, but need to su to another user to configure and complile the program properly. Whenever I do the shell script su's to the user properly but the scripts stops executing until I exit out of the new shell that su put me into. The following is an example of my script.
echo -e "\033[1m \n\t Installing courier-imap... \033[0m"
tar -xjf tar/courier-imap-184.108.40.20640207.tar.bz2
# build as vpopmail
chown -R vpopmail:vchkpw ../courier-imap-220.127.116.1140207
su - vpopmail
I have also tried using the following to stay in the same shell and preserve the environment:
su - -m -p vpopmail
Does anyone have any thought as to how I can successfully SU and keep the script running?