Thursday, December 16, 2010

Example for loop using bash script on Mac

Be careful when doing this... Note that ALL SPACES MUST BE EXACT. Or else bash will cry:


#!/bin/bash
a=1
while [ $a -le 10 ]
do
echo "Loop number $a"
a=$(( $a + 1 ))
done

No comments:

Post a Comment