I want to do something like this:
~ cat dump.sh
command 1 | command 2 | command 1 | command 2 | ...(ten times) | command 1 | command2
~ ./dump.sh < demo.log
So how to modify dump.sh
while I can specify exactly n
times of command 1
and command 2
in pair to process demo.log?
You can write a simple recursive helper function, something like this:
Invoke it like