Skip to main content
Minor words
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

If-Conditioncondition based on STDoutstandard output

I have few commands linked through pipes, and at the end is a conditional awkawk: 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 stdoutoutput (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;else; (blank output)
Do nothing

If-Condition based on STDout

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 stdout (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

If-condition based on standard output

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
deleted 6 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

Excuse my ignorance, 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 stdout (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

Excuse my ignorance, 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 stdout (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

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 stdout (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
Source Link
Sollosa
  • 2k
  • 5
  • 26
  • 43

If-Condition based on STDout

Excuse my ignorance, 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 stdout (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