As a simple example, I have a bunch of source code files. I want to store the "head" command output to a variable for all these files.
I tried:
output=$(head $file)
but what happened is that this automatically trimmed all \n
characters when storing the output to a variable.
How do I store the command output as is without removing \n
characters?
\n
is Line Feed, not Carriage Return