sed: correctly handle 'w FILE' commands writing to the same file
function old new delta sed_xfopen_w - 84 +84 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -405,6 +405,15 @@ testing "sed ^ OR not^" \
|
||||
"" \
|
||||
"abca\n"
|
||||
|
||||
# This only works if file name is exactly the same.
|
||||
# For example, w FILE; w ./FILE won't work.
|
||||
testing "sed understands duplicate file name" \
|
||||
"sed -n -e '/a/w sed.output' -e '/c/w sed.output' 2>&1 && cat sed.output && rm sed.output" \
|
||||
"a\nc\n" \
|
||||
"" \
|
||||
"a\nb\nc\n"
|
||||
|
||||
|
||||
# testing "description" "commands" "result" "infile" "stdin"
|
||||
|
||||
exit $FAILCOUNT
|
||||
|
||||
Reference in New Issue
Block a user