First create a file with this exact content:
I named this file
foo, if I run the following, it prints the exact content of the file:
bash -c 'bar=$(cat foo);echo "$bar"'
But if you run it with
sh instead of
bash the result is:
The problem here is that the
\n is being translated to a new line character that I do not want to.
My machine default
dash, the target machine is running an embedded linux with
busybox, so it is very minimalist, it works very similar to
If I run just
sh -c 'cat foo' it get the expected result, but I want it inside the variable, how could I do it?