Ihor Radchenko <yanta...@posteo.net> writes: > Max Nikulin <maniku...@gmail.com> writes: > >>> + shell-file-name >> ... >>> + (list shell-command-switch >>> + (concat (file-local-name script-file) " " >>> cmdline)))) >> >> Using `shell-command-switch' unconditionally may lead to executing >> /bin/sh instead of shell specified by `shell-file-name' for script files >> having no shebang, see >> >> https://superuser.com/questions/502984/writing-shell-scripts-that-will-run-on-any-shell-using-multiple-shebang-lines > > Good point.
I am looking at this again, and notice that the problem with `shell-command-switch' is tangent to the original bug report we are discussing. Currently, ob-shell uses two ways to execute the source block: 1. When :shebang header argument is provided, <script-file> '<cmdline>' 2. When :shebang is not provided <shell-file-name> <shell-command-switch> '<script-file> <cmdline>' The problem you linked to only manifests for calling script files _without_ shebang, while the original bug report is about the case when :shebang is given. I conclude that your concern, while being valid, is a _different_ bug. Thus, I do not see it as a blocker for my patch - my patch will fix the *original bug reported on top of this thread*. As for the problem with <shell-file-name> <shell-command-switch> <script-file> when <script-file> does not contain shebang, we can trivially at that shebang like (with-temp-file script-file (if shebang (insert shebang "\n") (insert "#!" shell-file-name "\n")) (when padline (insert "\n")) (insert body)) -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>