From all of my testing it seems like it is not possible to execute a local script remotely while allowing an interactive shell and passing arguments.
Interactive (arguments try to run as a seperate command either inside or outside the double quotes)
ssh -t server "$(<${scriptname})"
Arguments (Not interactive ofc)
cat $scriptname | ssh -t server bash -s - "${args[@]}"
I have really tried this every which way. Is it possible to both start an interactive shell and execute the script while also sending arguments?