Hi,

The following example shows that the order of the stdout/err output is
not maintained. It seems that stdout always goes earlier than stderr.
Is it so?

Is there a way to make the order to be the same as if gnu parallel is
not called.

$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

set -v
function cmd {
echo "$2"
echo "$1" >&2
echo "$2"
}

export -f cmd
printf '%s\t%s\n' {1..4} | parallel --colsep $'\t' 'cmd {1} {2}'
$ ./main.sh
function cmd {
echo "$2"
echo "$1" >&2
echo "$2"
}

export -f cmd
printf '%s\t%s\n' {1..4} | parallel --colsep $'\t' 'cmd {1} {2}'
2
2
1
4
4
3

-- 
Regards,
Peng

Reply via email to