Commit a26ad224 authored by Juan Benet's avatar Juan Benet

Merge pull request #1757 from ipfs/shell-quote

ipfs-test-lib: add shellquote()
parents 08e06764 1bd18205
......@@ -22,3 +22,15 @@ test_sort_cmp() {
sort "$2" >"$2_sorted" &&
test_cmp "$1_sorted" "$2_sorted"
}
# Quote arguments for sh eval
shellquote() {
_space=''
for _arg
do
printf '%s' "$_space"
printf '%s' "$_arg" | sed -e "s/'/'\\\\''/g; s/^/'/; s/\$/'/;"
_space=' '
done
printf '\n'
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment