How do I prepend a text to a file (the opposite of >>)?
You cannot do it with bash redirections only, ie the opposite of >> does not exist.
You can use an editor:
ed -s file << EOF i header line 1 header line 2 . w EOF
you can use things like:
{ echo line; cat file ;} >tmpfile && mv tmpfile file echo line | cat - file > tmpfile && mv tmpfile file
or a gazillion of other solutions