feat(user/mp4_make480.sh):Use default audio instead of copy
[BK-2020-03.git] / unitproc / bkt-read_psarg
CommitLineData
335b71e1
SBS
1#!/usr/bin/env bash
2# Desc: Reads positional arguments
3
4yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
5die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status
6must() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails
7read_psarg() {
8 # Desc: Reads arguments; outputs as stdout lines
9 # Input: args
10 # Output: stdout (newline delimited)
11 # Example: read_psarg "$@"
12 # Depends: GNU bash (version 5.1.16)
13 # Version: 0.0.1
14 local input_psarg output;
15
16 # Store arguments
17 if [[ $# -gt 0 ]]; then
18 input_psarg="$*";
19 fi;
20
21 # Store as output array elements
22 ## Read in positional arguments
23 if [[ -n $input_psarg ]]; then
24 for arg in "$@"; do
25 output+=("$arg");
26 done;
27 fi;
28
29 # Print to stdout
30 printf "%s\n" "${output[@]}";
31}; # read positional argument to stdout lines
32main() {
33 read_psarg "$@";
34};
35
36main "$@";