Peng Yu
2018-04-22 02:59:58 UTC
In the following example, 'o: stdout' is printed after the second
command line is called. Is there a way to make sure it is finished
when the first command line is finished? Thanks.
$ ./main.sh
./script.sh > >(awk -v oprefix='o: ' '{print oprefix $0; fflush(); }')
awk -v oprefix='o: ' '{print oprefix $0; fflush(); }'
stderr
./script.sh 2> >(awk -v eprefix='e: ' '{print eprefix $0 >>
"/dev/stderr"; fflush(); }')
awk -v eprefix='e: ' '{print eprefix $0 >> "/dev/stderr"; fflush(); }'
o: stdout
stdout
e: stderr
$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
set -v
./script.sh > >(awk -v oprefix='o: ' '{print oprefix $0; fflush(); }')
./script.sh 2> >(awk -v eprefix='e: ' '{print eprefix $0 >>
"/dev/stderr"; fflush(); }')
command line is called. Is there a way to make sure it is finished
when the first command line is finished? Thanks.
$ ./main.sh
./script.sh > >(awk -v oprefix='o: ' '{print oprefix $0; fflush(); }')
awk -v oprefix='o: ' '{print oprefix $0; fflush(); }'
stderr
./script.sh 2> >(awk -v eprefix='e: ' '{print eprefix $0 >>
"/dev/stderr"; fflush(); }')
awk -v eprefix='e: ' '{print eprefix $0 >> "/dev/stderr"; fflush(); }'
o: stdout
stdout
e: stderr
$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
set -v
./script.sh > >(awk -v oprefix='o: ' '{print oprefix $0; fflush(); }')
./script.sh 2> >(awk -v eprefix='e: ' '{print eprefix $0 >>
"/dev/stderr"; fflush(); }')
--
Regards,
Peng
Regards,
Peng