lib/common.sh: Make it safe to include multiple times.

This is similar to common C #ifdef guards.

I was tempted to wrap the entire thing in the if/fi, rather than use
'return' to bail early.  However, that means it won't execute anything
until after it reaches 'fi'.  And if `shopt -s extglob` isn't executed
before parsing, then it will syntax-error on the extended globs.  One
solution would have been to move `shopt -s extglob` up above the
include-guard.  But the committed solution is all-around simpler.
This commit is contained in:
Luke Shumaker 2017-04-02 04:10:02 -04:00 committed by Jan Alexander Steffens (heftig)
parent 747e8ffc8d
commit c1a056c9a8
No known key found for this signature in database
GPG Key ID: A5E9288C4FA415FA
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,9 @@
# License: Unspecified
[[ -z ${_INCLUDE_COMMON_SH:-} ]] || return 0
_INCLUDE_COMMON_SH=true
# Avoid any encoding problems
export LANG=C