Friday, October 19, 2012

Filter stderr for common commands

For work I use a Mac. Macs are totally broken in a lot of ways and when running utilities directly on the mac it has been the case more than once that I have to either suffer constant error messages or resort to trickery. Here's the trickery.


#============================================================
# ALIASES
#============================================================
alias vagrant="vagrant_suppress_gssapi_warnings"
alias puppet="puppet_suppress_iconv_warnings"


#============================================================
# FUNCTIONS
#============================================================
function vagrant_suppress_gssapi_warnings {
  {
    \vagrant "$@" 2>&1 >&3 | egrep -v 'Check your GSSAPI' >&2;
  } 3>&1
}

function puppet_suppress_iconv_warnings {
  {
    \puppet "$@" 2>&1 >&3 | egrep -v 'iconv will be depr' >&2;
  } 3>&1
}

No comments:

Post a Comment