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:
parent
747e8ffc8d
commit
c1a056c9a8
|
@ -3,6 +3,9 @@
|
|||
|
||||
# License: Unspecified
|
||||
|
||||
[[ -z ${_INCLUDE_COMMON_SH:-} ]] || return 0
|
||||
_INCLUDE_COMMON_SH=true
|
||||
|
||||
# Avoid any encoding problems
|
||||
export LANG=C
|
||||
|
||||
|
|
Loading…
Reference in New Issue