On Fri, Sep 27, 2013 at 01:48:13PM +0200, Bob Hope wrote:
> Should the output of set -x in a bash script be the same as the order it is
> executed in?
>
> # cat b.sh
> #!/bin/bash
> /usr/bin/tail -n 100 messages | /bin/grep blah | md5sum
>
> # bash -x b.sh
> + md5sum
> + /bin/grep blah
> + /usr/bin/tail -n 100 messages
> d41d8cd98f00b204e9800998ecf8427e -
They're all executed simultaneously. Which one you happen to see first
in the trace output is the result of a race condition, and therefore not
predictable.