The following snippet will run within the script, but it takes a long time for each loop.
#!/bin/bash
….
some_command $A $B $C | awk ‘{print$1}’ | while read -r var1; do
printf "
$var1
"
printf "
"
other_command $var1
printf "
"
done
….
I tried running this, but the printf statements will run before the other_command, which is used to make the output a little more readable.
#!/bin/bash
….
some_command $A $B $C | awk ‘{print$1}’ | while read -r var1; do
printf "
$var1
"
printf "
"|
other_command $var1 &
printf "
"
done
wait
….
If I run just other_command with the & in loop I get the desired result but it it not very readable.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…