On Friday, September 26, 2014 10:00:08 AM UTC+2, Andreas Schwab wrote: > Alexandre Ferrieux <alexandre.ferri...@gmail.com> writes: > > > So, what about, in bash's initialization, detecting that we are invoked as > > "/bin/sh", > > It already does. See (bash) Bash POSIX Mode.
Yes, it does do this detection, but too late for our concern, since things occur in the following order: (1) set_shell_name(argv[0]) => this detects "sh" and sets 'act_like_sh' (2) shell_initialize() => this decides to import funcs from env depending on flags like 'posixly_correct' (3) if (act_like_sh) ... sv_strict_posix ("POSIXLY_CORRECT") So it seems the order is wrong. As a consequence, and this is confirmed by experience, the #!/bin/sh prefix behaves as featuristic bash. My suggestion then is to undo that mistake. -Alex