Skip to content

Instantly share code, notes, and snippets.

@omar-yassin
Created October 3, 2014 14:30
Show Gist options
  • Save omar-yassin/2e480f12057eb8cdd52f to your computer and use it in GitHub Desktop.
Save omar-yassin/2e480f12057eb8cdd52f to your computer and use it in GitHub Desktop.
BASH: error catching pipes
tar ... | ssh ...
pipe_exit_status="${PIPESTATUS[@]}"
tar_status=`echo $pipe_exit_status | awk '{print $1}'`
ssh_status=`echo $pipe_exit_status | awk '{print $2}'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment