From 269627deec121839cf11cdcfab9f1fe3c421b2b4 Mon Sep 17 00:00:00 2001 From: Ross Smith II Date: Mon, 17 Feb 2020 00:51:55 -0800 Subject: [PATCH] Simplify example in readme (#133) --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d2d45c0..d596aef 100644 --- a/README.md +++ b/README.md @@ -98,12 +98,11 @@ As of `v1.0.3`, b3bp offers some nice re-usable libraries in `./src`. In order t It is nice to have a Bash package that can not only be used in the terminal, but also invoked as a command line function. In order to achieve this, the exporting of your functionality *should* follow this pattern: ```bash -if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then - export -f my_script -else +if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then my_script "${@}" exit $? fi +export -f my_script ``` This allows a user to `source` your script or invoke it as a script.