Add magic variable that stores the full command line invocation (#99)

Provides variable __invocation which contains the command line
with proper separators maintained.

Adapted from https://stackoverflow.com/a/36625791
This commit is contained in:
Gabriel A. Devenyi 2018-06-06 09:28:55 -04:00 committed by Kevin van Zonneveld
parent ee869a9584
commit 327cba75c9
2 changed files with 2 additions and 1 deletions

View File

@ -20,6 +20,7 @@ Released: TBA.
- [x] Change `egrep` to `grep -E` in test and lib scripts to comply with ShellCheck (#92, @gmasse)
- [x] Fix typo in FAQ (#92, @gmasse)
- [x] Fix Travis CI failure on src/templater.sh (@gmasse)
- [x] Add magic variable which contains full command invocation
## v2.3.0

View File

@ -47,7 +47,7 @@ fi
__dir="$(cd "$(dirname "${BASH_SOURCE[${__b3bp_tmp_source_idx:-0}]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[${__b3bp_tmp_source_idx:-0}]}")"
__base="$(basename "${__file}" .sh)"
__invocation="$(printf %q "${__file}")$((($#)) && printf ' %q' "$@")"
# Define the environment variables (and their defaults) that this script depends on
LOG_LEVEL="${LOG_LEVEL:-6}" # 7 = debug -> 0 = emergency