FG
💻 Software

Pipe grep exit code away

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

Problem

When I need to suppress some kind of output e.g. But foo gives sometimes only: grep will return -1. How do I transform the exit code 1 to 0?

Error Output

foo | grep -v bar

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Pipe grep exit code away

Low Risk

You could always try piping it through something else, like , to get rid of the exit code from grep - though that may be a bigger hammer than you want.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment