Skip to main content
1 of 3
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

You could do:

if { cmd 2>&1 >&3 3>&- | grep '^' >&2; } 3>&1; then
  echo there was some output on stderr
fi
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k