It’s all good. If you’re using bash and readline to read the file, you can use sudo echo ${INPUT@Q} (assuming your variable is named $INPUT) to have bash escape things like the quotes and other characters that could get you into trouble.
Sadly no, its injected with terraform templatefile, I already looked for a normal way to autoescape it, but from a brief look I couldn’t find one. I know there is a replace function that can take regex(RE2, which from my understanding prohibits * in lookbehinds)- but the simplest regex I could think of at nearly 6am for capturing only non-escaped quotes is /(?:^|[^\\])(?:(?:\\\\)+|[^\\]|^)(?'quote'")/gm. Though, I just realized if the quotes are escaped I would want to double escape them, so actually replacing all quotes with escaped quotes should be fine, also another limitation of this method is lines can’t have trailing \
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
Posts must be relevant to programming, programmers, or computer science.
No NSFW content.
Jokes must be in good taste. No hate speech, bigotry, etc.
It’s all good. If you’re using bash and readline to read the file, you can use
sudo echo ${INPUT@Q}
(assuming your variable is named $INPUT) to have bash escape things like the quotes and other characters that could get you into trouble.Sadly no, its injected with terraform
templatefile
, I already looked for a normal way to autoescape it, but from a brief look I couldn’t find one. I know there is a replace function that can take regex(RE2, which from my understanding prohibits*
in lookbehinds)- but the simplest regex I could think of at nearly 6am for capturing only non-escaped quotes is/(?:^|[^\\])(?:(?:\\\\)+|[^\\]|^)(?'quote'")/gm
. Though, I just realized if the quotes are escaped I would want to double escape them, so actually replacing all quotes with escaped quotes should be fine, also another limitation of this method is lines can’t have trailing\