plan9fox/sys/src/libsec/port/reduce
cinap_lenrek 85bfb0e9eb reduce: use if() to test for exit status of pipeline
The new rc's exit status will be '' for a successfull
pipeline execution instead of '|'.

This is a bit too tightly coupled, so just use if()
statement instead, handling this in a portable way.
2022-01-10 02:01:11 +00:00

13 lines
275 B
Plaintext

O=$1
shift
objtype=$1
shift
if(ls -p ../$objtype/*.[cs] >[2]/dev/null | sed 's/..$//;s/^/^/' > /tmp/reduce.$pid) {
echo $* | tr ' ' \012 | grep -v -f /tmp/reduce.$pid | tr \012 ' '
}
if not {
# if empty directory, just return the input files
echo $*
}
rm /tmp/reduce.$pid