Found the issue!
As always, with these types of problems, it was some minor annoyance that was causing it - a carriage return/line feed in the test.txt file after the string.
If I do a wc -c on the file it would give me 16 instead of 14 (2 extra for the CRLF).
Thanks for your help!
I've changed my code to use the var1=${var1}123 (thanks blowtorch) notation and also the var1=$(<test.txt) (thanks macosta) notation, which looks cleaner.
|