bash - Is it possible to send multiple commands to vagrant ssh via a shell script? -


i'm on windows host using git bash run .sh files.


there 4 components current project. start on localhost, have to:

  1. webdriver-manager start since i'm qa , need running anyway
  2. vagrant up in project's parent folder, close out window (or start vm myself via virtualbox ui)
  3. vagrant ssh cd /vagrant cd "component's folder" docker-compose up x 4
  4. grunt serve

right now, have .sh file each 1, 2, , 4, cannot find how pass along multiple commands vagrant ssh, since docker-compose up needs running.

is there way pass along cds , docker-compose?


i found the ssh documentation vagrant mentions needing fancy things running background processes, have no idea it's doing or how implement in .sh file since wording wishy-washy.

also, i'm new shell scripts in general, if there's smarter way go solve issue, i'd appreciate it, too. these scripts aren't necessary, don't want have type repeatedly every day when i'm running tests locally.

from vagrantfile, have this

$script = <<script echo "running script in vm" cd /vagrant cd "component's folder" docker-compose cd "component's folder 2" docker-compose # , add other commands run vm script  vagrant.configure(2) |config|   ....   config.vm.provision "shell", inline: $script   .... end 

note: run commands sudo (from vm) if want run them vagrant user, do

config.vm.provision "shell", inline: $script, privileged: "false" 

Comments