0

just tinkering with some code that writes variables to a file on a new line. But when I do this:

echo "${upl}:${xy}" >> NOT_CAPTIONED_IDS.txt

Where $upl=someyoutubeid and $xy=somefilename.mp4

I get the line written to the file (someyoutubeid:somefilename.mp4), but an additional newline added after the text. Is this normal behaviour? Can I stop it from adding that, I still want to append the string on a new line Python doesnt appear to add the new line with f.write, but I cant use that in this case without a major reworking.

Thanks

Nowski
  • 173
  • 1
  • 14

1 Answers1

-1

Echo adds a new line. You may use printf if that is not required.

See Bash's Built-in printf Function for more examples.

Quiescent
  • 1,088
  • 7
  • 18