Subject: [grep: input file './x’ is also the output] too late!.. have a null file.

From: davidpbrown <[email-masked]>
Date: Fri, 23 Mar 2018 19:35:26 +0000

Hi,

Surprised that the error is noted but only after the file gets clobbered.

Example:
=====================
echo "blah" > ./x
grep -v 'foo' ./x > ./x
# grep: input file './x’ is also the output
# results with x being empty.
=====================

Would have expected that catch to be caught ahead of writing a null in
place of the original file.

bash -v
suggests
RELEASE: 2.1
this on Linux Mint.

Regards
davidpbrown