mirror of
https://github.com/kvz/bash3boilerplate.git
synced 2025-05-02 16:32:50 +00:00
parent
272dd896d0
commit
9dea81377e
@ -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:
|
||||
|
||||
```bash
|
||||
if [ "${BASH_SOURCE[0]}" != ${0} ]; then
|
||||
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
|
||||
export -f my_script
|
||||
else
|
||||
my_script "${@}"
|
||||
|
@ -64,7 +64,7 @@ function ini_val() {
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "${BASH_SOURCE[0]}" != ${0} ]; then
|
||||
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
|
||||
export -f ini_val
|
||||
else
|
||||
ini_val "${@}"
|
||||
|
@ -57,7 +57,7 @@ function megamount () {
|
||||
ls -al "${target}/"
|
||||
}
|
||||
|
||||
if [ "${BASH_SOURCE[0]}" != ${0} ]; then
|
||||
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
|
||||
export -f megamount
|
||||
else
|
||||
megamount "${@}"
|
||||
|
@ -62,7 +62,7 @@ function parse_url() {
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "${BASH_SOURCE[0]}" != ${0} ]; then
|
||||
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
|
||||
export -f parse_url
|
||||
else
|
||||
parse_url "${@}"
|
||||
|
@ -50,7 +50,7 @@ function templater() {
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "${BASH_SOURCE[0]}" != ${0} ]; then
|
||||
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
|
||||
export -f templater
|
||||
else
|
||||
templater "${@}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user