bash: improve operating system detection

The -s flag to `uname` makes sure that only the string "Darwin" is
printed, so the comparison is safer.
This commit is contained in:
Fernando Schauenburg 2021-02-25 19:41:34 +01:00
parent e5f4c25593
commit 9c4c579938

View file

@ -32,7 +32,7 @@ export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py"
# See: https://superuser.com/a/583502
# shellcheck disable=SC2123 # PATH is being intentionally manipulated here.
# shellcheck disable=SC1091 # /etc/profile is provided by macOS.
[ "$(uname)" == "Darwin" ] && { PATH=""; source /etc/profile; }
[ "$(uname -s)" == "Darwin" ] && { PATH=""; source /etc/profile; }
_prepend_path() { # prepend $1 to var $2 avoiding duplicates using : as separator
if [ -d "$1" ] && [ -n "$2" ]; then