Skip to main content
The 2024 Developer Survey results are live! See the results
added 383 characters in body
Source Link
wuschelhase
  • 1.1k
  • 1
  • 9
  • 18

Let's say I have 2 bash commands:

$ A
apple
pear
lemon

A is writing this really fast but waiting 1 minute after "lemon" to terminate successfully.

I want every line being processed as input for B separately and instantly. but I do not want to wait for A to terminate but rather call a new B for every fast appearing line. B would then add something to the output of A let's say:

$ A <for every line appearing> B
1 apple
1 pear
1 banana

How can I do this with bash?

update

here are the original commands:

$sudo alive6 -l eth1 -W 0.2 | sed -e 's/Alive: \(.*\) \[ICMP echo-reply\]/\1%eth0/' -e'/Scanned.*/d' -e'//d'

responds instantly, while

$sudo alive6 -l eth1 -W 0.2 | sed -e 's/Alive: \(.*\) \[ICMP echo-reply\]/\1%eth0/' -e'/Scanned.*/d' -e'//d' | while read l; do echo $l; done

seems to wait for alive6 to finish

Let's say I have 2 bash commands:

$ A
apple
pear
lemon

A is writing this really fast but waiting 1 minute after "lemon" to terminate successfully.

I want every line being processed as input for B separately and instantly. but I do not want to wait for A to terminate but rather call a new B for every fast appearing line. B would then add something to the output of A let's say:

$ A <for every line appearing> B
1 apple
1 pear
1 banana

How can I do this with bash?

Let's say I have 2 bash commands:

$ A
apple
pear
lemon

A is writing this really fast but waiting 1 minute after "lemon" to terminate successfully.

I want every line being processed as input for B separately and instantly. but I do not want to wait for A to terminate but rather call a new B for every fast appearing line. B would then add something to the output of A let's say:

$ A <for every line appearing> B
1 apple
1 pear
1 banana

How can I do this with bash?

update

here are the original commands:

$sudo alive6 -l eth1 -W 0.2 | sed -e 's/Alive: \(.*\) \[ICMP echo-reply\]/\1%eth0/' -e'/Scanned.*/d' -e'//d'

responds instantly, while

$sudo alive6 -l eth1 -W 0.2 | sed -e 's/Alive: \(.*\) \[ICMP echo-reply\]/\1%eth0/' -e'/Scanned.*/d' -e'//d' | while read l; do echo $l; done

seems to wait for alive6 to finish

added 1 characters in body
Source Link
Shahbaz
  • 47.2k
  • 19
  • 117
  • 186

Let's say I have 2 bash commands:

$A$ A
apple
pear
lemon

A is writing this really fast but waiting 1 minute after "lemon" to terminate successfully.

I want every line being processed as input for B separately and instantly. but I do not want to wait for A to terminate but rather call a new B for every fast appearing line. B would then add something to the output of A let's say:

$ A <for every line appearing> B
1 apple
1 pear
1 banana

How can I do this with bash?

Let's say I have 2 bash commands:

$A
apple
pear
lemon

A is writing this really fast but waiting 1 minute after "lemon" to terminate successfully.

I want every line being processed as input for B separately and instantly. but I do not want to wait for A to terminate but rather call a new B for every fast appearing line. B would then add something to the output of A let's say:

$ A <for every line appearing> B
1 apple
1 pear
1 banana

How can I do this with bash?

Let's say I have 2 bash commands:

$ A
apple
pear
lemon

A is writing this really fast but waiting 1 minute after "lemon" to terminate successfully.

I want every line being processed as input for B separately and instantly. but I do not want to wait for A to terminate but rather call a new B for every fast appearing line. B would then add something to the output of A let's say:

$ A <for every line appearing> B
1 apple
1 pear
1 banana

How can I do this with bash?

Source Link
wuschelhase
  • 1.1k
  • 1
  • 9
  • 18

Process a line in bash as is appears

Let's say I have 2 bash commands:

$A
apple
pear
lemon

A is writing this really fast but waiting 1 minute after "lemon" to terminate successfully.

I want every line being processed as input for B separately and instantly. but I do not want to wait for A to terminate but rather call a new B for every fast appearing line. B would then add something to the output of A let's say:

$ A <for every line appearing> B
1 apple
1 pear
1 banana

How can I do this with bash?