ksh - keep argument variables after ssh

i have a script that should ssh to different host/server. See below:

./script.ksh var1 var2 var3
case $ser in
   ser1)
         depo='appr1'
         set -A aprrA aprrB
         ssh ser2 "/home/dir/script.ksh $1 $2 $3"
         ssh ser3 "/home/dir/script.ksh $1 $2 $3"
         ssh ser4 "/home/dir/script.ksh $1 $2 $3"
         x=something
   ;;
   serA)
         depo='appr2'
         set -A aprrC aprrD
         ssh serB "/home/dir/script.ksh $1 $2 $3"
         ssh serC "/home/dir/script.ksh $1 $2 $3"
         ssh serD "/home/dir/script.ksh $1 $2 $3"
         x=another_thing
   ;;
esac

I was wondering if after the

ssh

command, will this

/home/dir/script.ksh $1 $2 $3

command still knows the values of variables

$1, $2, $3

.

Yes. $1, $2, $3 are only changed when you do set -- .

will the command

"/home/dir/script.ksh $1 $2 $3

still run properly in ser2? and will it still ssh to in ser3 and ser4?

The positional parameters will stay intact inside the script unless actively modified by the script itself by e.g. set -- or shift

If this isn't working, it isn't because the parameters aren't being passed to the remote machines by ssh . Is script.ksh located in /home/dir on the machines serB , serC , and serD ; or is your script located in that directory on the local machine only? The pathname to the script you're running has to be valid on the machine on which you're trying to run it. And, of course, using unquoted $1 , $2 , and $3 won't work if any of those variables contain any IFS characters (usually <space>, <tab>, and <newline>) and might not work if they expand to strings that contain characters that are special in pathname pattern matching (such as ? , * , and [ ).