3 ms·
Other options that are perhaps faster to use on the fly, are bash/zsh's builtin printf and GNU's printf command, with the %q conversion specifier (modulo the ne
by dundarious 5y ago
Other options that are perhaps faster to use on the fly, are bash/zsh's builtin printf and GNU's printf command, with the %q conversion specifier (modulo the newline/trailing space issue).
> bash$ printf "%q " \"yo" dude"\', it\'s\ me'!' ; echo
> \"yo\ dude\'\, it\'s\ me\!
> $ command printf "%q " \"yo" dude"\', it\'s\ me'!' ; echo
> \"yo\ dude\'\, it\'s\ me\!