-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjqtest.sh
30 lines (23 loc) · 901 Bytes
/
jqtest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function lines() { echo -ne "$1"|jq -M -R -s 'split("\n")'; }
declare -a ran
ran+=("$(jq -c -n \
--argjson args "$(lines "arg1\narg2\narg3")" \
--arg delay "arg4" \
--arg loops "arg5" \
--argjson stdout "$(lines "This\nis\nStandard Out")" \
--argjson stderr "$(lines "This\nis\nStandard Error")" \
'$ARGS.named' \
)")
ran+=("$(jq -c -n \
--argjson args "$(lines "arg1\narg2\narg3")" \
--arg delay "arg4" \
--arg loops "arg5" \
--argjson stdout "$(lines "This\nis\nStandard Out")" \
--argjson stderr "$(lines "This\nis\nStandard Error")" \
'$ARGS.named' \
)")
function display()
{
jq -c -s . <<< "$(for item in "$@"; do echo "$item";done)"
}
display "${ran[@]}"