# '"'"' '\''
# '\'' is a much better quoted-single-in-singles than '"'"' #sh
# quote() { printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/"; }
# quoted=$(quote "$var")
quote() {
  q="$2'"
  r=''
  while [ "$q" ]; do
    r="$r${q%%\'*}'\''" && q=${q#*\'}
  done
  q="'${r%????}'" && q=${q#\'\'} && q=${q%\'\'}
  eval "$1=\${q:-\"''\"}"
}
