JSON encode in bash -
is there better alternative doing:
echo "{\"error\": \"must executed using user account 'admin'.\"}" >&2; in bash scripts?
you try here document:
cat <<eot {"error": "must executed using user account 'admin'."} eot this works unless have single line containing eot in text wish cat. if that's problem, can select alternate token, e.g.
cat <<foo eot foo additionally, if find basic here documents resulting in unwanted expansion, e.g.
cat <<eot foo$a eot will try expand $a, can quote here document token stop expansion:
cat <<'eot' foo$a eot
Comments
Post a Comment