[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] It this temporary file good, or bad?
From: |
Greg Chicares |
Subject: |
[lmi] It this temporary file good, or bad? |
Date: |
Wed, 15 Jun 2022 00:24:47 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 |
Vadim--Please consider commit ae17ea6bdfdc, which adds this
makefile target:
show_overlooked_cxx_warnings:
@$(CXX) $(ALL_CXXFLAGS) -Q --help=warning -xc++ /dev/null \
| $(GREP) '[[]disabled[]]' \
| $(SED) -e's/[ \t]*[[]disabled[]]//' -e's/^ *-W//' \
> eraseme
@$(GREP) -of eraseme $(this_makefile) | $(GREP) -vxf - eraseme || true
@$(RM) eraseme
It seems to work just fine, but it troubles me that I couldn't
find a way to do this without a temporary file. Isn't there a
better, more unixy way that avoids that file? Reusing the same
stream twice seems to call for 'tee', but I don't see how to
make it work here.
Let me try to draw a picture of what I was hoping to do:
cmd | tee >>>>> "grep -oF - workhorse.make" +
| |
>>>>>>>>>>>>> <<<<<<<<<<<<
| |
grep -vf stream#1 stream #2 --> output
It's easy enough to split the stream into two rivulets with 'tee';
what I can't figure out is how to recombine the two rivulets as
arguments in the final grep command. This is tantalizingly close
to common examples like:
diff <(sort file1) <(sort file2)
but I seem to be missing the magic glue to put it together.
What would a unix master do?
- [lmi] It this temporary file good, or bad?,
Greg Chicares <=