Skip to content
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

Use printf %q for simplicity and binary safety #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix deletion of "weird" keys
  • Loading branch information
Artoria2e5 authored Sep 19, 2016
commit da8c3800c6bda1f852f6b36d5172fb3857794f2d
8 changes: 4 additions & 4 deletions quinedb
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ case "$1" in
echo 'OK' >&2
;;
"delete")
unset db["$2"]
unset 'db[$2]'
echo 'OK' >&2
;;
"keys")
for k in "${!db[@]}"; do echo "$(printf %q "$k")"; done >&2
printf '%q\n' "${!db[@]}" >&2
;;
*)
echo "USAGE: quinedb [get k | set k v | delete k | keys]" >&2
Expand Down Expand Up @@ -143,11 +143,11 @@ case "$1" in
echo 'OK' >&2
;;
"delete")
unset db["$2"]
unset 'db[$2]'
echo 'OK' >&2
;;
"keys")
for k in "${!db[@]}"; do echo "$(printf %q "$k")"; done >&2
printf '%q\n' "${!db[@]}" >&2
;;
*)
echo "USAGE: quinedb [get k | set k v | delete k | keys]" >&2
Expand Down