Hacker News new | ask | show | jobs
by grymoire1 3462 days ago
You can include quotes in arguments on Unix systems. The only tricky bit is getting meta-characters past the shell to the command the shell executes.

Example

  #!/bin/bash
  Q1="'"
  Q2='"'
  echo "$Q1$Q2"
This prints

  '"
And if you really understand that ' and " turn quoting on and off anywhere in the line, you can combine these two into a single variable:

  #!/bin/bash
  Q1="'"'"'
  echo "$Q1"
1 comments

Yeah, that's the very behaviour I'm talking about - it just happens to be a problem in this particular case: the single-quotes in hk__2's PROPS variable would be passed to the executed command, not interpreted by the shell, but we wanted the latter here.