2 # Desc: Reads positional arguments
4 yell
() { echo "$0: $*" >&2; } # print script path and all args to stderr
5 die
() { yell
"$*"; exit 111; } # same as yell() but non-zero exit status
6 must
() { "$@" || die
"cannot $*"; } # runs args as command, reports args if command fails
8 # Desc: Reads arguments; outputs as stdout lines
10 # Output: stdout (newline delimited)
11 # Example: read_psarg "$@"
12 # Depends: GNU bash (version 5.1.16)
14 local input_psarg output
;
17 if [[ $# -gt 0 ]]; then
21 # Store as output array elements
22 ## Read in positional arguments
23 if [[ -n $input_psarg ]]; then
30 printf "%s\n" "${output[@]}";
31 }; # read positional argument to stdout lines