I've come across a behavior I can't explain. When I run a bash script without a shebang, the ps command will not show the script and its arguments as arguments passed to bash, neither will /proc/$$/cmdline, whereas If I run the script with a shebang, behavior is as expected.
Example with a shebang:
# cat mytest
#!/bin/bash
echo my name is $1
cat /proc/$$/cmdline
echo
ps -p $$ -o args=
# ./mytest John
my name is John
/bin/bash./mytestJohn
/bin/bash ./mytest John
Example without a shebang:
# cat mytest
echo my name is $1
cat /proc/$$/cmdline
echo
ps -p $$ -o args=
# ./mytest John
my name is John
-bash
-bash
In both cases the script will display 'my name is John', but without a shebang I see the bash process without any arguments. How is this possible?