confusion about using parallel to replace a for loop

2022-01-21 Thread John
When I run the simple script below, initially, there is no output to the shell until the function finishes. Is there a switch I can use for parallel so that the function outputs below the sleep command finishes? #!/bin/bash hash=( 1 2 3 4 5 6 7 8 9 ) getit() { echo "this is $1" sleep 1s } e

Re: confusion about using parallel to replace a for loop

2022-01-21 Thread Joe Sapp
On Fri, Jan 21, 2022 at 6:03 AM John wrote: > When I run the simple script below, initially, there is no output to the > shell until the function finishes. Is there a switch I can use for > parallel so that the function outputs below the sleep command finishes? > > #!/bin/bash > hash=( 1 2 3 4 5

Re: Parallel Digest, Vol 141, Issue 3

2022-01-21 Thread Thomas Bereknyei
sleep 1s > } > > export -f getit > parallel -j 3 getit ::: "${hash[@]}" > > Please cc me on any replies as I am not subscribed to the ML. > -- next part -- > An HTML attachment was scrubbed... > URL: > <https://lists.gnu.or

Re: confusion about using parallel to replace a for loop

2022-01-21 Thread John
Thank you for the suggestion, Joe. Adding --ungroup to my command gives the desired outcome. On Fri, Jan 21, 2022 at 12:44 PM Joe Sapp wrote: > On Fri, Jan 21, 2022 at 6:03 AM John wrote: > >> When I run the simple script below, initially, there is no output to the >> shell until the function