Issue
Im trying to execute 2 commands in 12 different servers using a loop. When i try to do it remotly my sequence fails and it just iterate using i=12. Do I need some scape character?
ssh 10.10.10.10 "for i in {01..12}; do modpkg -e -n host-prv$i; runpkg -n host-prv$i; done"
UPDATE - worked after using single quotes - thanks @dave_thompson_085
ssh 10.10.10.10 'for i in {01..12}; do modpkg -e -n host-prv$i; runpkg -n host-prv$i; done'
Solution
user1934428's comment here is one solution, but you could also refactor the command and move the loop to run in the local shell, will the side effect of having to run ssh for each iteration:
for i in {01..12}; do ssh 10.10.10.10 "modpkg -e -n host-prv$i; runpkg -n host-prv$i"; done
Answered By - MikeK Answer Checked By - Mildred Charles (WPSolving Admin)