I'm trying to use an IF/ELSE statement inside a FOR loops to generate two output files: count1 with numbers 1-5; count2 with numbers 6-10
I am trying
for i in {1..10}
do
if [ $i -le 5 ]
then
echo $i > count1.out
else
echo $i > count2.out
fi
done
but count1 only has "5" in it and count2 shows "10"
How can I fix this?
>>instead of>.>>appends text, but>overwrites whatever is in the file.