mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-01 06:17:56 +08:00
Merge pull request #1757 from ipfs/shell-quote
ipfs-test-lib: add shellquote()
This commit is contained in:
commit
a26ad22434
@ -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'
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user