echo >> style appending, but to the beginning of a file
shell, unix
Solution
In 2 steps:
content=$(cat file.txt) # no cat abuse this time
echo -en "foobar\n$content" >file.txt
Problem
Is there any nice trick in UNIX shell to append lines to the beginning of a file? E.g. akin to ``` echo "Foobar" >> file.txt ``` ... but instead new lines would prepend the existing ones?