Simone Web Design

Loop through parameters in Bash

Iterating over the arguments in a Bash script is way simpler than you might expect.
See this gist:

In the snippet above, "$@" represents all the parameters. The echo "$i" shall obviously print each argument on a separate line.

It’s always a good idea to wrap parameters within quotes, because you’d never know when a parameter might contain spaces or whatever.