I'm Running a master.sh file from machine A to B via SSH.
This master file call another 4 snippet .sh that has to be executed using other user.
i run the master.sh i'm currently on /pathA/pathB/master.sh
ssh machineB "bash -sh" < master.sh
system_metrics=$(su mdm -c ./snippet1.sh)
system_metrics=$(su mdm -c /pathA/pathB/snippet1.sh)
Ok in order to close the questions Running a sh file local script from Machine A to Remote Machine B:
Running an sh (Not available on the machine B) file that does not call any other snippet.sh, can be done using ssh.
Running an sh master (Not available on the machine B) file that calls other snippet.sh, cannot be done using ssh if the snippet.sh is not available on the Machine B.