Support bash versions prior to 4.2#577
Open
danielchasehooper wants to merge 1 commit intoEpicGamesExt:masterfrom
Open
Support bash versions prior to 4.2#577danielchasehooper wants to merge 1 commit intoEpicGamesExt:masterfrom
danielchasehooper wants to merge 1 commit intoEpicGamesExt:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
if [ -v variable ]syntax was introduced in bash 4.2, so in order to support prior bash versions, I reverted to theif [ "$var" = "1" ]syntax.To avoid unbound variable errors caused by
set -u, I assign 0 to variables before doing argument parsing. There are pre-bash-4.2 ways to check if a variable is set without triggering the unbound variable warning (such asif [ "${clang+set}"]) but that's pretty weird looking, so I thought it was simpler to just declare the variables ahead of time.I realize that you removed that syntax, likely due to a combination of wanting the cleaner
-vsyntax, and needing to play nice with theset -uunbound variable check, but hopefully the incompatibility with bash <4.2 was an oversight and not a choice (I was just trying to build with bash 3.2)