For Loop without a list-of-words parameter

suggest change
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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents