Difference between revisions of "Bash loops"

From Tech-Wiki
Jump to: navigation, search
(Created page with "Category:Linux Executing a Do loop to repeat one command with different hosts for n in {1..5}; do ssh host0$n "shutdown"; done Executing the same command forever while...")
 
Line 2: Line 2:
  
 
Executing a Do loop to repeat one command with different hosts
 
Executing a Do loop to repeat one command with different hosts
  for n in {1..5}; do ssh host0$n "shutdown"; done
+
  # for n in {1..5}; do ssh host0$n "shutdown"; done
  
 
Executing the same command forever
 
Executing the same command forever
  while true; do date +%s; done
+
  # while true; do date +%s; done

Revision as of 20:24, 13 February 2017


Executing a Do loop to repeat one command with different hosts

# for n in {1..5}; do ssh host0$n "shutdown"; done

Executing the same command forever

# while true; do date +%s; done