summaryrefslogtreecommitdiff
path: root/sys/src/ape
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-01-10 02:01:11 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-01-10 02:01:11 +0000
commit85bfb0e9ebb8f2238cff6c03e93c0dce31581845 (patch)
treeee5e130ea6961a649d0192a79b6c0b16a735eee1 /sys/src/ape
parent4d872079d36939c3287b2968fbada7c4e4738762 (diff)
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.
Diffstat (limited to 'sys/src/ape')
-rw-r--r--sys/src/ape/lib/ap/gen/reduce14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/src/ape/lib/ap/gen/reduce b/sys/src/ape/lib/ap/gen/reduce
index 584f8b9ab..0deb098c4 100644
--- a/sys/src/ape/lib/ap/gen/reduce
+++ b/sys/src/ape/lib/ap/gen/reduce
@@ -2,15 +2,11 @@ O=$1
shift
objtype=$1
shift
-
-ls -p ../$objtype/*.[cs] >[2]/dev/null | sed 's/..$//;s/^/^/' > /tmp/reduce.$pid
-#
-# if empty directory, just return the input files
-#
-if (! ~ $status '|') {
+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
- exit 0
}
-echo $* | tr ' ' \012 | grep -v -f /tmp/reduce.$pid | tr \012 ' '
rm /tmp/reduce.$pid