Closed hasnat closed 6 years ago
@hasnat Hi 👋 thanks for this contribution!
Just so I'm clear, you want rekcod to better handle environment variables that contain the characters !
, (
, and )
in their values, specifically by escaping those characters with a backslash and/or wrapping them in double-quotes?
I wonder if there aren't other special characters that would need to be escaped as well, e.g. $
and &
? I guess this depends on the shell.
Regardless I'd like to do a bit of local testing with actual Docker containers before I review or merge this. Do you have a (lightweight) image I could pull and test with? If not, I'll try out some of the usual suspects. ;)
some characters can't be used without double quotes e.g. !
for others only escaping them was enough.
you're right, I just noticed we also need to escape &
, ?
there could be way more than those. I can investigate later, but yes it would depend on bash/zsh/shell.
feel free to add commits to this.
for testing docker run command I use https://hub.docker.com/r/tianon/true/
I havent tried but seems promising, I can convert this to use single quotes then we only need to escape single quotes
Reference: https://stackoverflow.com/a/20053121/254044
@hasnat I think I like the single quotes approach better, let's go with that.
@nexdrew all yours now
@hasnat Released as version 2.1.0. Give it a shot and let me know how it goes. Thanks again!
escaping & encapsulating some special characters or you might get
-bash: !: event not found
OR-bash: syntax error near unexpected token
('`