Please consider the script foo.bash
#!/bin/env bash
echo "$@"
echo
for x in "${@:0:$# + 1}" ; do
echo "$x"
done
Then ./foo.bash a b c gives the output
a b c
./foo.bash
a
b
c
As far as I understand the documentation, @ holds the positional arguments, so the output of echo "$@" makes sense to me.
But why does the for loop print the script name?
edit:
I'm using Git BASH on Windows, echo $BASH_VERSION yields 4.4.23(1)-release