Gracefully handle missing USER env var

Prompted by https://github.com/Homebrew/install/pull/213
This commit is contained in:
Joe Horsnell 2019-07-01 17:25:25 +01:00
parent 6418230f8f
commit 19fd56468f

View File

@ -4,6 +4,11 @@ then
export LC_ALL="en_US.UTF-8"
fi
# The USER env var is not guaranteed to be available, so fall back to id if not
# provided. We destructively set it in the environment to make it available to
# any sub-processes called.
export USER=${USER:-`id -un`}
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
if [[ -d "$HOMEBREW_REPOSITORY/Cellar" ]]