Changing to root user inside shell script
===

I have a shell script which needs non-root user account to run certain commands and then change the user to root to run the rest of the script. I am using SUSE11.
I have used expect to automate the password prompt. But when I use
spawn su -
and the command gets executed, the prompt comes back with root and the rest of the script does not execute.

Eg.
   
    < non-root commands>
     spawn su -
    <root commands>

But after su - the prompt returns back with user as root.
How to execute the remaining of the script.

The sudo -S option does not help as it does not run sudo -S ifconfig command which I need to find the IP address of the machine.

I have already gone through these links but could not find a solution:
http://stackoverflow.com/questions/521226/change-script-directory-to-users-homedir-in-a-shell-script

http://stackoverflow.com/questions/11493464/changing-unix-user-in-a-shell-script

Thanks in advance

