File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,17 @@ getTrueShellExeName() { # mklement0 https://stackoverflow.com/a/23011530/7471760
189189 # If the executable is a symlink, resolve it to its *ultimate*
190190 # target.
191191 while nextTarget=$( readlink " $trueExe " ) ; do trueExe=$nextTarget ; done
192+
193+ if [ " $( basename " $trueExe " ) " = " sh" ]; then
194+ # on MacOS, sh is NOT a symlink but an executable, so trueExe is 'sh' but it will
195+ # re-exec according to symlink at /private/var/select/sh, so resolve it
196+ if [ -L " /private/var/select/sh" ] && [ -e " /private/var/select/sh" ] ; then
197+ while nextTarget=$( readlink " /private/var/select/sh" ) ; do trueExe=$nextTarget ; done
198+ else
199+ # otherwise default to bash
200+ trueExe=" /bin/bash"
201+ fi
202+ fi
192203 # Output the executable name only.
193204 printf ' %s' " $( basename " $trueExe " ) "
194205}
You can’t perform that action at this time.
0 commit comments