Last active
May 21, 2024 02:49
-
-
Save nasa9084/caee63465acb712d43301c488534e7b5 to your computer and use it in GitHub Desktop.
Revisions
-
nasa9084 revised this gist
May 21, 2024 . 1 changed file with 10 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,11 +2,16 @@ readonly version="0.0.1" for opt in ${@} do case "${opt}" in "-h") echo A jq/jnv transparent wrapper exit 0 ;; "-v") echo jq.sh version "${version}" ;; esac done @@ -36,4 +41,4 @@ case "${#}" in cat | jq "${@}" fi ;; esac -
nasa9084 revised this gist
May 20, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Empty file. -
nasa9084 created this gist
May 20, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ #!/bin/bash readonly version="0.0.1" while getopts hv OPT do case "${OPT}" in "h") echo jq.sh: filter JSON using jq or jnv transparently && exit 0;; "v") echo jq.sh version "${version}" && exit 0;; esac done case "${#}" in 0) if [ -t 0 ] then echo error: no argument is passed exit 1 else cat | jnv fi ;; 1) if [ -t 0 ] then jnv "${1}" else cat | jq "${1}" fi ;; *) if [ -t 0 ] then jq "${@}" else cat | jq "${@}" fi ;; esac