Posts

If-condition based on standard output

Image
up vote 0 down vote favorite I have few commands linked through pipes, and at the end is a conditional awk : example below command1 | command 2 | awk '$1 > 800' Now sometimes it will output few lines, and sometimes no lines. I want a condition that will prove true only if there's some output (1 or more lines) Is there a way to make it work? Like, if command1 | command 2 | awk '$1 > 800' (some output); then do command3 else; (blank output) Do nothing scripting stdout share | improve this question edited Nov 14 at 12:36 Kusalananda 116k 15 218 351 ...