FG
💻 Software

Make a pipe conditional on non-empty return

Fresh5 days ago
Mar 15, 202620840 views
Confidence Score0%
0%

Problem

Is there a way to pipe the output of one function to another, but only if there is an output?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Make a pipe conditional on non-empty return

Low Risk

This should work for you An example It's simple but it should work for you. If your "a function" sends an empty string or even a newline down the pipeline, xargs -r, will prevent passage through to "another function". Reference for xargs: http://www…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment