On 23/04/2024 17:51, Max Nikulin wrote:
I am in favor of dropping `shell-command-switch' in the latter case to pass arguments literally in both cases.

Dropping "-c" may have side effects. Instead of :shebang, a source block may have shebang in the body

#+begin_src bash
#!/bin/bash -e
echo first; false; echo second

This shebang is ignored if the script is executed as
    bash /tmp/script
and respected in the case of
    bash -c /tmp/script
Shebang in the script body may be detected to run it as
    /bin/bash -e /tmp/script

To avoid interpretation of shell specials in script arguments when "-c" is used, it is possible to use a trick
    bash -c /tmp/script ob-shell arg1 arg2 arg3
The -c option adds extra execve() call in comparison to
    /tmp/script arg1 arg2 arg3
Perhaps it may be neglected.

It may be more tricky on Windows where shebangs are likely ignored even by bash. However I do not thing ob-shell is working on windows since `shell-command-switch' should be /c there instead of -c since default shell is cmd.exe.

Reply via email to