To suppress the xargs: bash: exited with status 255; aborting message without silencing stderr globally or hardcoding the exclusion of this specific line, you can use a combination of 2>&1 and grep -v to filter out the unwanted message while preserving other stderr output.
Here’s how you can do it:
Redirect stderr to stdout (2>&1), then filter out the specific line using grep -v:
bash(echo a && echo b && echo c) | xargs -I % bash -c 'echo % && echo % | grep -q b && exit 255' 2>&1 | grep -v "xargs: bash: exited with status 255; aborting"
2>&1: Redirects stderr to stdout, so both streams are combined.grep -v "xargs: bash: exited with status 255; aborting": Filters out the specific line you want to suppress while allowing all other output (including other stderr messages) to pass through.The output will now be:
texta b
The xargs error message is suppressed, but all other stderr output (if any) would still appear.
If you want to ensure only this specific line is suppressed (and not other similar lines), use a more precise grep pattern:
bash(echo a && echo b && echo c) | xargs -I % bash -c 'echo % && echo % | grep -q b && exit 255' 2>&1 | grep -v -F "xargs: bash: exited with status 255; aborting"
-F: Treats the pattern as a fixed string (not a regex), which is safer for exact matches.stderr globally (e.g., with 2>/dev/null).Vibe can make mistakes. Check answers. Learn more