Hi,
In my shell script i have the following line:
export PATH=$PATH:/home/$USER/somedir.
Say im logged in as user mike . I need to execute the shell script as root, so i run it as sudo filename.sh, so $USER becomes root in my path in that case .
I want it to be that of the user running the script, i.e. mike instead of root. Is there a way to achieve this ?
Thank You