In order to run interactive command or script which require you to input something , you can use -t option with ssh.

eg. ssh -t x.y.z.a 'sh /some/script.sh'