home | changes | index | login
BashTricks. I always forget how to do this, and I'm sick of looking it up for that once every two months when I need it.
anton.lr2.com/archives/2005/03/24/using-a-bash-for-loop-to-wget/ - Slurp up some of this info.
for arg in list do command... done
Don't feel like you have to string this all together on one line when you're doing it in an interactive shell. Just hit enter after each line.
To steal an example:
for planet in "Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto" do echo $planet done
Note that list can be the output of a given program - just use backticks, like so:
for doc in
A real world example:
for release in
iconv -f iso-8859-1 -t utf-8 ./$release ../converted/$release.html
You probably should use globs instead, though:
for release in * do foo ./$release done
pick a name (required to comment or edit a page)