run complex shell script on remote host.
when trying to pass complex command through ssh,
some value get executed/resolved localy rather than on the remote host.
to avoid this situation, create a script and pass it to ssh.