bash - Alias for SSH and run command in a Vagrant VM -


i have 2 vagrant machines in folder, , i'm having ssh in both , run same command. do:

$ vagrant ssh machine1 [vagrant@machine1 ~]$ sudo rm -rf /tmp/cache/* [vagrant@machine1 ~]$ exit  $ vagrant ssh machine2 [vagrant@machine2 ~]$ sudo rm -rf /tmp/cache/* [vagrant@machine2 ~]$ exit 

i'd create alias or little script can run , things, don't need type again , again...
ideas?

to this, can add alias:

alias vssh="vagrant ssh machine1 -c 'sudo rm -rf /tmp/cache/*'; vagrant ssh machine2 -c 'sudo rm -rf /tmp/cache/*'" 

add profile (i.e. ~/.bash_profile or similar file), reload running:

. ~/.bash_profile 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -