Skip to content

Instantly share code, notes, and snippets.

@ion1
Created November 29, 2018 04:50
Show Gist options
  • Save ion1/96693bb61dc67cbf6239f736ef3b322c to your computer and use it in GitHub Desktop.
Save ion1/96693bb61dc67cbf6239f736ef3b322c to your computer and use it in GitHub Desktop.
shellquote
shellquote() {
local space=
for arg; do
printf '%s' "$space"
printf '%s' "$arg" | sed -e "s/'/'\\\\''/g; s/^/'/; s/\$/'/;"
space=' '
done
printf '\n'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment