lhunath/scripts — pull request #1 by dualbus (2012-09-07 20:37:28+00:00)
Title: Fix issue with `quote' function.

The original function had:

quotedArgs+=("$(printf "'%s'" "${arg//"'"/"\\'"}")")

Which mixes single and double quoting, breaking the escaping. The point is to
use just one type of quotes, but escaping in the RHS of the var/foo/bar
parameter expansion is tricky. So I used a local variable to hold the 4-char
single quote expansion, which should remove the problem.

A simple test:

var="a'b"; . ./bashlib; eval echo "$(quote "$var")";