When I run the following code
echo '1' > file.txt
echo '2' | paste file.txt - > file.txt
I would expect the content of file.txt
be 1 2
, because the paste
command as it name suggests should put the two strings simply side-by-side.
However, it is just 2
.
Could anyone of you point me towards additional diagnostics to run in order to pin down the problem.
echo '2' >> file.txt
. Your issue is that you are using>
rather than>>
. – Questionmark Apr 20 '15 at 15:33