]> arthur.barton.de Git - bup.git/blob - dev/shquote
test-restore-map-owner: accommodate python 3 and test there
[bup.git] / dev / shquote
1 #!/bin/sh
2
3 set -eu
4
5 case "$#" in
6     0) src="$(cat)";;
7     1) src="$1";;
8     *)
9         echo "Usage: shquote [SOMETHING]" 1>&2
10         exit 2
11         ;;
12 esac
13
14 printf %s\\n "$src" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/"