@aidan@lemmy.world
creator
link
fedilink
120d

I’m reading this and interpreting that line 27 of that script is

And your interpretation is wrong. Line 27 is actuallly

sudo echo "${server_service}" > /lib/systemd/system/server.service

${server_service} is read from the file I posted in the 2nd image. Since it was a test script I hadn’t bothered implementing any escaping tools, I wanted to make sure terraform allowed this first.

And there’s your problem. You’re echoing using double quotes which will interpret characters. Don’t do that. That’s a bug. cat or cp the file to the destination; printf if the contents are all in that variable.

@aidan@lemmy.world
creator
link
fedilink
120d

No, you’re still misunderstanding what’s being done. ${server_service} is an injected string, the string is the whole contents of the file. That file is not stored locally on the server, except through being injected here(by a terraform file template). And no, printf won’t be any better than echo because its not format string, and I don’t want any formatting from printf applied to it.

Create a post

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.
  • 1 user online
  • 120 users / day
  • 257 users / week
  • 744 users / month
  • 3.72K users / 6 months
  • 1 subscriber
  • 1.48K Posts
  • 32.5K Comments
  • Modlog