Bash redirection combined with "double pipe" notation

bash, linux, redirect

Solution

#!/bin/bash

RESULT=`wget -qO- example.com/duff`

if [ $? -eq 0 ];
then
  echo $RESULT | some_processing >> outfile.txt
fi

Problem

Is it possible to combine redirecting output to a file and pipes with ||? (Not sure what this is called) Example: ``` (wget -qO- example.com/duff || exit) | some_processing >> outfile.txt ``` If wget fails, I would like to exit and not run some_processing or create the blank file.

Original source