On 2013-09-27 06:19, B Hope wrote:
> I am using "set -x" to debug a shell script. On a single core VM I get the
> debug output (the lines beginning "+ ") reversed. The script ends with the
> same
> result. Should the order of the output when using "-x" always be the same?
>
> $ cat b.sh
> #!/bin/bash
> /usr/bin/tail -n 100 messages | /bin/grep blah | md5sum
>
> $ bash -x b.sh
> + md5sum
> + /usr/bin/grep blah
> + /usr/bin/tail -n 100 messages
> hsdhdfhdfhdfhfhdfh -
The order of execution is totally arbitrary when using a pipe, because
they are all executed simultaneously.