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:
|
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 "${@}"
|
||||||
|
@ -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 "${@}"
|
||||||
|
@ -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 "${@}"
|
||||||
|
@ -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 "${@}"
|
||||||
|
@ -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 "${@}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user