1
0
Fork 0

Add missing mapfile workaround for Mac

This commit is contained in:
Jeremy Kaplan 2020-01-07 09:18:38 -08:00
commit 9b1e62c8ea

14
install
View file

@ -24,10 +24,18 @@ load_config() {
OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
if [ -f "${PROFILES_FILE}" ]; then if [ "$#" -gt 0 ]; then
mapfile -t profiles < "${PROFILES_FILE}"
else
profiles=("${@}") profiles=("${@}")
elif [ -f "${PROFILES_FILE}" ]; then
# MacOS bash 3.2 doesn't have mapfile. Workaround from
# http://mywiki.wooledge.org/BashFAQ/005#Loading_lines_from_a_file_or_stream
unset profiles
while IFS= read -r; do
profiles+=("$REPLY")
done < "${PROFILES_FILE}"
[[ $REPLY ]] && profiles+=("$REPLY")
else
profiles=()
fi fi
for conf in default "${OS_NAME}" "${profiles[@]}"; do for conf in default "${OS_NAME}" "${profiles[@]}"; do