mardi 13 janvier 2015

Is there another simple way to append line to end of file other than `>>`?


Recently I'm echoing short sentences to a tree_hole file.


I was using echo 'something' >> tree_hole to do this job.


But I was always worried of what if I mis-input of > instead of >>, since I did this often.


So I made a global bash func of my own in the bashrc:



function th { echo "$1" >> /Users/zen1/zen/pythonstudy/tree_hole; }
export -f th


But I'm wondering if there is another simple way to append lines to the end of a file. Because I may need to use that often in other occasions.


Is there any?



Aucun commentaire:

Enregistrer un commentaire