Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

echo to add line to file

touch sample.txt 
echo "this is line one" > sample.txt  #adds this as first line
echo "this is line two" >> sample.txt #appends the line to sample.txt

#if you do echo "this will remain alone" > sample.txt
#	it will rewrite the sample.txt file with the string passed above
 
PREVIOUS NEXT
Tagged: #echo #add #line #file
ADD COMMENT
Topic
Name
1+7 =