Swap echo for printf when handling json
1 files changed, 6 insertions(+), 6 deletions(-)

M invertbucket
M invertbucket +6 -6
@@ 148,7 148,7 @@ srhtreq() {
 }
 
 jqget() {
-	echo "$1" | jq -r "$2"
+	printf '%s\n' "$1" | jq -r "$2"
 }
 
 urlencode() {

          
@@ 163,7 163,7 @@ do_issue_comment() {
 	ticket_id="$3"
 	comment="$4"
 
-	content="$(echo "$comment" | jq .content.raw)"
+	content="$(printf '%s' "$comment" | jq .content.raw)"
 	user="$(jqget "$comment" .user.display_name)"
 	user_url="$(jqget "$comment" .user.links.html.href)"
 	created="$(jqget "$comment" .created_on)"

          
@@ 175,7 175,7 @@ do_issue_comment() {
 	if [ "$(jqget "$resp" .errors)" != "null" ]
 	then
 		printf "Failed to import comment:\n" >&2
-		echo "$resp" | jq . >&2
+		printf '%s' "$resp" | jq . >&2
 		return 1
 	fi
 }

          
@@ 186,7 186,7 @@ do_issue() (
 	issue="$3"
 
 	title="$(jqget "$issue" .title)"
-	content="$(echo "$issue" | jq .content.raw)"
+	content="$(printf '%s' "$issue" | jq .content.raw)"
 	reporter="$(jqget "$issue" .reporter.display_name)"
 	reporter_url="$(jqget "$issue" .reporter.links.html.href)"
 	created="$(jqget "$issue" .created_on)"

          
@@ 244,7 244,7 @@ do_issues() (
 	if [ "$(jqget "$resp" .errors)" != "null" ]
 	then
 		printf "Failed to create ticket tracker:\n" >&2
-		echo "$resp" | jq . >&2
+		printf '%s' "$resp" | jq . >&2
 		return 1
 	fi
 	srht_name=$(jqget "$resp" .name)

          
@@ 313,7 313,7 @@ do_repo() (
 	if [ "$(jqget "$resp" .errors)" != "null" ]
 	then
 		printf "Failed to create %s repository:\n" "$host" >&2
-		echo "$resp" | jq . >&2
+		printf '%s' "$resp" | jq . >&2
 		return 1
 	fi
 	srht_name=$(jqget "$resp" .name)