Skip to main content
According to the man page of bash, - is equivalent to --, i.e. only -s can serve for the intended purpose
Source Link

The here document is passed to the inner bash on its standard input. You need to instruct bash to read from standard input. With no command line arguments, this happens automatically. If there's at least one non-option argument and no -s or -c option, the first non-option argument is the name of the script file to run. You can pass - to specify standard input. Alternatively, pass the -s option to tell bash to read from standard input.

bash <<'EOF' - -- arg1 arg2 arg3
echo "$0 $*"
EOF

or

bash <<'EOF' -s -- arg1 arg2 arg3
echo "$0 $*"
EOF

The here document is passed to the inner bash on its standard input. You need to instruct bash to read from standard input. With no command line arguments, this happens automatically. If there's at least one non-option argument and no -s or -c option, the first non-option argument is the name of the script file to run. You can pass - to specify standard input. Alternatively, pass the -s option to tell bash to read from standard input.

bash <<'EOF' - -- arg1 arg2 arg3
echo "$0 $*"
EOF

or

bash <<'EOF' -s -- arg1 arg2 arg3
echo "$0 $*"
EOF

The here document is passed to the inner bash on its standard input. You need to instruct bash to read from standard input. With no command line arguments, this happens automatically. If there's at least one non-option argument and no -s or -c option, the first non-option argument is the name of the script file to run. You can pass the -s option to tell bash to read from standard input.

bash <<'EOF' -s -- arg1 arg2 arg3
echo "$0 $*"
EOF
Source Link
Gilles 'SO- stop being evil'
  • 866.1k
  • 205
  • 1.8k
  • 2.3k

The here document is passed to the inner bash on its standard input. You need to instruct bash to read from standard input. With no command line arguments, this happens automatically. If there's at least one non-option argument and no -s or -c option, the first non-option argument is the name of the script file to run. You can pass - to specify standard input. Alternatively, pass the -s option to tell bash to read from standard input.

bash <<'EOF' - -- arg1 arg2 arg3
echo "$0 $*"
EOF

or

bash <<'EOF' -s -- arg1 arg2 arg3
echo "$0 $*"
EOF