Debugging and Parameter problems of shell script

my question is that I want to execute a script on the remote machine centos, and then search for the answer I see in stackoverflow: shell-script-on-a-remote-machine/2732991-sharp2732991" rel=" nofollow noreferrer "> question
where the method is:

ssh root@MachineB "bash -s" < local_script.sh

I have tried this method, but now I need to specify parameters, such as local_script.sh-ub
and how to use bash-x when debugging scripts. You can see exactly where the execution failed, instead of printing and judging the execution result all the time.

Mar.31,2021

something like this

-sharp!/bin/bash

ssh root@192.2.1.160 <<'ENDSSH'
cd /home/app/scripts/
sh -x arr.sh 'test'
ENDSSH

that's what you do

-sharp!/bin/bash

ssh root@MachineB <<'ENDSSH'
cd xxx
sh -x local_script.sh -ub
ENDSSH
Menu