0

My code file looks as follows

     Cd testR
     Mkdir bin
     chmod -R 755 bin
     Sudo su - inst1 
     cp inst1/installable/files/testR.p
     ...
     ...

So after sudo su the execution get paused please let me know what should i do

  • Please do research. It's not possible to switch user inside a script. [reference and workarounds](https://stackoverflow.com/questions/1988249/how-do-i-use-su-to-execute-the-rest-of-the-bash-script-as-that-user#:~:text=It's%20not%20possible%20to%20change%20user%20within%20a%20shell%20script.) – Rahul K May 02 '22 at 05:40

1 Answers1

-1

If there is no problem that your commands are executing as root, you can execute your script like this: sudo ./yourscript

So, you don't have to switch within your shell script.