Reputation: 89
I'm using command line
grep -rI "TEXTSEARCH" . > output.txt
and I get the error/prompt
grep: input file ‘./output.txt’ is also the output
Seems to work successfully but don't want to make extensive searching if this is something to worry about or is that just a regular response?
Upvotes: 2
Views: 6031
Reputation: 601
-I and . means "all files in the current directory".
As output.txt is created as soon as the command starts
grep -rI "TEXTSEARCH" output.txt > output.txt
happens. So it makes sense.
if "output.txt" is not in the same folder, no issue.
grep -rI "TEXTSEARCH" . > /tmp/output.txt;mv /tmp/output.txt .
Upvotes: 4