I wrote the following script:
for filename in `find . -name '*'.cpp | grep $IN_REGEX | grep -v $OUT_REGEX` do echo "Output file is $OUTPUT_FILE" count=`git log --pretty=format: --name-only $filename | grep -v ^$ | wc -l` echo "$count $filename" >> $OUTPUT_FILE done
But nothing gets written into the output file.
Please note:
- I have set the values for
OUTPUT_FILE
,IN_REGEX
andOUT_REGEX
. - The code inside the loop is being executed. I checked this with an
sh -x
invokation. - When I remove the
>> $OUTPUT_FILE
I get the output. - I tried a
touch $OUTPUT_FILE
inside the script and that is working fine.
Can someone please point out what is my mistake here?
>>$OUTPUT_FILE
to the end of the loop, i.e.done >>$OUTPUT_FILE
?dos2unix
ord2u
on the files to convert to Unix line ending. See the output ofcat -vte
on the file to confirm.touch
works. All three don't show any problem.