Skip to content

Commit

Permalink
add default value for unset env variables
Browse files Browse the repository at this point in the history
Closes IDFGH-4784
  • Loading branch information
sio13 committed Mar 8, 2021
1 parent d20a5c3 commit 1673183
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ idf_export_main() {
# Doing this in case someone tries to chmod +x it and execute...

# shellcheck disable=SC2128,SC2169,SC2039 # ignore array expansion warning
if [ -n "${BASH_SOURCE}" ] && [ "${BASH_SOURCE[0]}" = "${0}" ]
if [ -n "${BASH_SOURCE-}" ] && [ "${BASH_SOURCE[0]}" = "${0}" ]
then
echo "This script should be sourced, not executed:"
# shellcheck disable=SC2039 # reachable only with bash
Expand All @@ -32,10 +32,10 @@ idf_export_main() {
self_path=""

# shellcheck disable=SC2128 # ignore array expansion warning
if [ -n "${BASH_SOURCE}" ]
if [ -n "${BASH_SOURCE-}" ]
then
self_path="${BASH_SOURCE}"
elif [ -n "${ZSH_VERSION}" ]
elif [ -n "${ZSH_VERSION-}" ]
then
self_path="${(%):-%x}"
else
Expand Down Expand Up @@ -145,7 +145,8 @@ enable_autocomplete() {
then
autoload -Uz compinit && compinit -u
eval "$(env _IDF.PY_COMPLETE=source_zsh idf.py)" || echo "WARNING: Failed to load shell autocompletion!"
else
elif [ -n "${BASH_SOURCE-}" ]
then
eval "$(env _IDF.PY_COMPLETE=source_bash idf.py)" || echo "WARNING: Failed to load shell autocompletion!"
fi
}
Expand Down

0 comments on commit 1673183

Please sign in to comment.