Saturday, March 2, 2013

How could you generate a sequence of numbers in Shell Scripting?

#!/bin/bash

for (( count=1; count <= 3 ; count++ ))
do
 echo "Value of count = $count."
done

# Or

#!/bin/bash

for count in $(seq 4 7)
do
 echo "Value of count = $count."
done

# Or

#!/bin/bash

for count in {7..10}; do
 echo "Value of count = $count."
done

No comments :