Fix unquoted variable access within [ tests… #34

Thanks to galaktos
This commit is contained in:
Kevin van Zonneveld 2016-06-22 20:36:17 +02:00
parent 272dd896d0
commit 9dea81377e
5 changed files with 5 additions and 5 deletions

View File

@ -106,7 +106,7 @@ As of `v1.0.3`, b3bp adds some nice re-usable libraries in `./src`. In order to
It's nice to have a Bash package that can be used in the terminal and also be invoked as a command line function. To achieve this the exporting of your functionality *should* follow this pattern: It's nice to have a Bash package that can be used in the terminal and also be invoked as a command line function. To achieve this the exporting of your functionality *should* follow this pattern:
```bash ```bash
if [ "${BASH_SOURCE[0]}" != ${0} ]; then if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
export -f my_script export -f my_script
else else
my_script "${@}" my_script "${@}"

View File

@ -64,7 +64,7 @@ function ini_val() {
fi fi
} }
if [ "${BASH_SOURCE[0]}" != ${0} ]; then if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
export -f ini_val export -f ini_val
else else
ini_val "${@}" ini_val "${@}"

View File

@ -57,7 +57,7 @@ function megamount () {
ls -al "${target}/" ls -al "${target}/"
} }
if [ "${BASH_SOURCE[0]}" != ${0} ]; then if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
export -f megamount export -f megamount
else else
megamount "${@}" megamount "${@}"

View File

@ -62,7 +62,7 @@ function parse_url() {
fi fi
} }
if [ "${BASH_SOURCE[0]}" != ${0} ]; then if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
export -f parse_url export -f parse_url
else else
parse_url "${@}" parse_url "${@}"

View File

@ -50,7 +50,7 @@ function templater() {
fi fi
} }
if [ "${BASH_SOURCE[0]}" != ${0} ]; then if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
export -f templater export -f templater
else else
templater "${@}" templater "${@}"