• Mac OS X,  Mac OS X Server,  Ubuntu,  Unix

    Basic bash Looping

    In bash, there area number of ways you can write loops. Here, we’ll look at putting a single line with a loop in it. This will be done using the for command. For requires a do and a done. The do is what we’ll do for each iteration. Here, we’ll just run a loop from 1 to 10 and then we’ll do an echo on that variable so it displays on the screen as well loop: for i in {1..10} ; do echo $i; done The output would then be as follows: 1 2 3 4 5 6 7 8 9 10