For specific reasons, I'm trying to create a second file identical to the first one without using cp
by using cat
and echo
My current bash code is
contents=$(cat file1)
echo $contents > file2
and I have the diff here
https://www.diffchecker.com/UIbkWHi5
The differences have to do with spaces/newlines, and I've played around with some echo
flags (namely -n
and -e
) to no avail. Where can I go from here?