rcaloras / bash-preexec

⚡ preexec and precmd functions for Bash just like Zsh.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Install fails when bash is in POSIX mode

mohd-akram opened this issue · comments

I run my bash in POSIX mode and noticed that the install step fails due to how trap is used (see Bash POSIX Mode).

To fix it, I did something like this:

case :$SHELLOPTS: in *:posix:*) posix=1;; esac
if [ "$posix" ]; then pre="set +o posix"; post="set -o posix"; fi
. bash-preexec.sh
PROMPT_COMMAND="$pre
$PROMPT_COMMAND
$post"

Maybe it would be useful to incorporate this into the script.

This should be fixed now, see #106.

That said, POSIX-compatibility is hard to maintain, and shouldn't be expected of a project that doesn't commit to doing so. If you choose to run your shell in POSIX mode you should expect that numerous "standard" Bash features, and libraries that depend on those features, will not work.

@mohd-akram can you confirm latest master fixes this? Closing feel free to reopen otherwise.