-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support piping into set #14
Comments
A simple function jsonlite_set {
while read value; do
echo "$value" | json_reformat > "$JSONLITE_PATH/$uuid"
done;
}
echo '{"a": "b"}' | jsonlite_set |
Seems like changing the local value="$1"
if [[ -z "$value" ]]; then
while read -r piped; do
value=$piped
done;
fi
if [[ -z "$value" ]]; then
echo "Missing required argument json document" 1>&2
exit 4
fi Seems to work. Can you think of a better way to write this? |
The problem here is that (haven't tested it, correct me if I'm wrong) if you do something like |
I actually got something working: if [[ -z "$value" && ! -t 0 ]]; then
while read -r piped; do
value+=$piped
done;
fi The trick was using |
That's nice, I didn't know about the |
How to support piping into set?
The text was updated successfully, but these errors were encountered: