I have two scripts, we say long.sh and simple.sh: it takes a lot of time, the second is very simple is . The output of the first script should be used as the input of another.
As an example, "long.sh" can be:
#! For the line in `cat LONGIFLE.dat` tax / bin / sh; # Line to read; # Some complex processing (takes time); The echo went to $ line;
And the simplest one:
#! During reading / bin / sh; Do # processing simple; Echo $ a + "other stuff" done;
I want to script it two scripts:
sh long.sh | Sh simple.sh
To use pipelines, wait for the end of the long script before starting simple.sh.
I would like to know if the current line is simple in Bash Shell. It is possible to see the output, so that I can see the time in which row is being processed.
I do not want to merge two scripts together, nor to call simple.sh within long.sh. Thanks a lot.
The standout is normally buffer. You want the line buffer to try
stdbuf -oL sh long.sh | Sh simple.sh
Note that this loop
cat for line in 'LONGIFLE.dat`; Do # see that I've put a semi-colon?
reads words from the file if you only have one word per line, then you are okay. Otherwise, to read by the rows, use while the IFS = read -r line; Tax ...; Did & lt;
Always quote your variable ( resonant "$ line"
), unless you do not know specifically when and when not.
Comments
Post a Comment