diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-04-02 08:18:01 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-04-02 13:39:59 +0300 |
commit | 42da15c1fbff60c4a49705b96ebb30721ccafb14 (patch) | |
tree | 3b86ccf4fd01e7224b5e401ba14cd49cee78ebae /%HOME%/.bash_utils/alternatives.sh | |
parent | .bash_utils: remove mysql.sh (diff) | |
download | linux-home-42da15c1fbff60c4a49705b96ebb30721ccafb14.tar.gz linux-home-42da15c1fbff60c4a49705b96ebb30721ccafb14.zip |
bash: best practices & linting
Diffstat (limited to '')
-rw-r--r-- | %HOME%/.bash_utils/alternatives.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/%HOME%/.bash_utils/alternatives.sh b/%HOME%/.bash_utils/alternatives.sh index 58fcfc3..3cfb958 100644 --- a/%HOME%/.bash_utils/alternatives.sh +++ b/%HOME%/.bash_utils/alternatives.sh @@ -9,6 +9,7 @@ alias update-my-alternatives='update-alternatives --quiet --altdir ~/.local/etc/ setup_alternatives_cc() ( set -o errexit -o nounset -o pipefail + shopt -s inherit_errexit gcc_cc="$( command -v gcc 2> /dev/null )" || return 0 gcc_cxx="$( command -v g++ 2> /dev/null )" || return 0 @@ -24,6 +25,7 @@ setup_alternatives_cc() ( setup_alternatives() ( set -o errexit -o nounset -o pipefail + shopt -s inherit_errexit command -v update-alternatives > /dev/null 2>&1 || return 0 mkdir -p -- ~/.local/etc/alternatives ~/.local/var/lib/alternatives @@ -35,12 +37,16 @@ setup_alternatives alt_gcc() ( set -o errexit -o nounset -o pipefail + shopt -s inherit_errexit + gcc_cc="$( command -v gcc 2> /dev/null )" update-my-alternatives --set cc "$gcc_cc" ) alt_clang() ( set -o errexit -o nounset -o pipefail + shopt -s inherit_errexit + clang_cc="$( command -v clang 2> /dev/null )" update-my-alternatives --set cc "$clang_cc" ) |