Question : how to concatenate into the starting of a file ?

if I do

echo "first line" >> /tmp/1

then it will add at the last line of file /tmp/1,, how can I add(concatenate) on the first line of file /tmp/1 ??

Answer : how to concatenate into the starting of a file ?

A version that will work on all Unix/Linux systems is

(echo "first line" ; cat /tmp/1) >/tmp/$$ && mv /tmp/$$ /tmp/1
Random Solutions  
 
programming4us programming4us