Script – bash while loop

Posted by admin on Jun 18, 2009 in Scripts |

#!/bin/bash
while read line;
do echo “<option>$line</option>” >> cities.out;
done < cities.in

# above processes a text file where a line item might contain spaces
# a for loop that cat’s the file will process each space as a separate item
#!/bin/bash
x=1
while [ $x -le 100 ]
do
  echo “Hello World – $x times”
  x=$(( $x + 1 ))
done

Reply

Copyright © 2012 BenMcGrail.com All rights reserved.
Hosted by: VitexOnline.com