# A `for` loop without `in` iterates over a copy of "$@", so a `set --` or # `shift` in the body must not disturb the words still to come. set -- one two three for a; do set -- xxxxxxxxxxxxxxxx y echo "[$a]" done set -- one two three for a; do shift echo "shift [$a]" done f() { set -- replaced more echo "in f: [$1]" } set -- p q for a; do f echo "fn [$a]" done