I have a shell script that I need to execute some commands with a linux user, and some other commands with another user.
Something like this:
#!/bin/bash echo 'rodando com usuário A' comando1 comando2 comando3 echo 'Rodando com Usuário B' sudo su comando4
The problem is that I would like to perform all the commands in the same script. But as soon as the command with the second user is started, a new session bash
is started.
Is it possible to run commands with 2 different users in the same script?