Late to the party, but this is still turning up high in Google search results.
Here's another nice way of sending scripts to a remote using a HEREDOC.
If on a Windows host, you'd need to be using a bash emulator like Git Bash or CygWin.
Note the escaped dollar sign, to prevent variables from being interpreted locally.
vagrant ssh admin -- -t <<HEREDOC
currentLogin=\$(whoami)
echo "hello \${currentLogin}"
pwd
ls -alZ
HEREDOC
hello vagrant
/home/vagrant
drwx------. vagrant vagrant unconfined_u:object_r:user_home_dir_t:s0 .
drwxr-xr-x. root root system_u:object_r:home_root_t:s0 ..
-rw-------. vagrant vagrant unconfined_u:object_r:user_home_t:s0 .bash_history
-rw-r--r--. vagrant vagrant unconfined_u:object_r:user_home_t:s0 .bash_logout
-rw-r--r--. vagrant vagrant unconfined_u:object_r:user_home_t:s0 .bash_profile
-rw-r--r--. vagrant vagrant unconfined_u:object_r:user_home_t:s0 .bashrc
drwx------. vagrant vagrant system_u:object_r:ssh_home_t:s0 .ssh
vagrant ssh -c 'echo hello; /bin/bash'
– Ronnie