I'm on macOS (the same happens on Ubuntu). Here is my default/current shell:
$ ps -p $$
PID TTY TIME CMD
5835 ttys002 0:00.13 -bash
Then, here is my document foo.tex:
\documentclass{article}
\begin{document}
\immediate\write18{ps -p $$ > stdout}
\end{document}
I'm compiling it and then checking the output:
$ pdflatex --shell-escape foo.tex && cat stdout
...
PID TTY TIME CMD
6876 ttys002 0:00.00 sh -c ps -p $$ > stdout
As you see, the shell is sh, instead of bash. How to fix this? I need bash to be executed by \write18.
shbut whatever/bin/shsymlinks to (on my Ubuntu that isdash), and also that you can change it by modifying the symlink. – Marijn Oct 12 '23 at 08:55