Don't call the ok and fail functions in a subshell. Bad idea.
Change-Id: Ic8c1dd12620773c700d4200385def2983d5bd59e
# collect data and analyze timestamps
dlogutil -b main -d -v $format | (
prev_ts=0
- unsorted=""
prev_line=""
while read -r line; do
if [ "$ts" -ge "$prev_ts" ]; then
prev_ts=$ts
else
- printf -v unsorted '%s\n\n%s\n%s' "$unsorted" "$prev_line" "$line"
- break
+ printf "%s\n%s\n\n" "$prev_line" "$line" || break
fi
prev_line=$line
done
+ ) | grep -q ^ && fail || ok
- [ -z "$unsorted" ] && ok || fail
- )
done
fi