@@ 99,7 99,7 @@ get_field() {
*) return ;;
esac
- tmp="${1#*\"$2\":\"}"
+ tmp="${1#*\""$2"\":\"}"
while [ -n "$tmp" ]; do
rest="${tmp#?}"
c="${tmp%"$rest"}"
@@ 108,7 108,7 @@ get_field() {
'"')
break
;;
- '\')
+ "\\")
printf '%s' "$c"
rest="${tmp#?}"
c="${tmp%"$rest"}"
@@ 152,7 152,7 @@ stream_events() {
}
cleanup() {
- kill $spinner_pid 2>/dev/null
+ kill "$spinner_pid" 2>/dev/null
clear_line
}
@@ 164,7 164,7 @@ term() {
trap term INT TERM
show_help() {
- printf '%s\n' "usage: $(basename $0) [-hes] prompt"
+ printf '%s\n' "usage: $(basename "$0") [-hes] prompt"
printf '%s\n' "options:"
printf '%s\n' " -h, --help show this help message and exit."
printf '%s\n' " -e, --edit open an editor to enter the prompt interactively."
@@ 204,13 204,13 @@ else
stdin="$(cat)"
fi
-parse_args $*
+parse_args "$@"
if [ $editor_mode = true ]; then
tmp=$(mktemp)
- printf '%s' "$prompt" >$tmp
+ printf '%s' "$prompt" > "$tmp"
$(editor) "$tmp"
- prompt="$(cat $tmp)"
+ prompt="$(cat "$tmp")"
fi
if [ $shell_mode = true ]; then