for arg; do
echo arg=$arg
done
A for
loop without a list of words parameter will iterate over the positional parameters instead. In other words, the above example is equivalent to this code:
for arg in "$@"; do
echo arg=$arg
done
In other words, if you catch yourself writing for i in "$@"; do ...; done
, just drop the in
part, and write simply for i; do ...; done
.