fzf/shell
Christoph Anton Mitterer f103aa4753
Improve interactiveness checks (#3449)
* [bash] return instead of not executing an if-block, when non-interactive

This should keep the code more readable, be less error prone (accidentally doing
something outside the if-block and aligns the code with what’s already done for
zsh.

`0` is returned, because it shall not be considered an error when the script is
(accidentally) sourced from a non-interactive shell.

If executed as a script (rather than sourced), the results are not specified by
POSIX but depend on the shell, with bash giving an error in that case.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>

* [shell] exit immediately when called from non-interactive shell

The shell execution environment shouldn’t be modified at all, when called from a
non-interactive shell.

It shall be noted that the current check may become error prone for bash, namely
in case there should ever be a differentiation between `i` and `I` in the
special variable `-` and bash’s `nocasematch`-shell-option be used.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-10-09 01:19:28 +09:00
..
completion.bash Improve interactiveness checks (#3449) 2023-10-09 01:19:28 +09:00
completion.zsh Improve interactiveness checks (#3449) 2023-10-09 01:19:28 +09:00
key-bindings.bash Improve interactiveness checks (#3449) 2023-10-09 01:19:28 +09:00
key-bindings.fish [shell] don’t needlessly escape . in shell pattern 2023-09-24 13:23:40 +09:00
key-bindings.zsh Improve interactiveness checks (#3449) 2023-10-09 01:19:28 +09:00