First page Back Continue Last page Overview

 

for and sequences

 
  • for loops are useful for iterating through numeric sequences

    • Use bash notation for simple sequences for i in {0..10}
      • Will use: 0,1,2,3,4,5,6,7,8,9,10
    • Use seq command for arbitrary increments for i in $(seq 0 2 10)
      • Will count by twos: 0,2,4,6,8,10