Skip to content

Instantly share code, notes, and snippets.

@d630
Last active June 18, 2016 09:59
Show Gist options
  • Save d630/56a4e036f2612dbdd101f6b72161c963 to your computer and use it in GitHub Desktop.
Save d630/56a4e036f2612dbdd101f6b72161c963 to your computer and use it in GitHub Desktop.
bash: multi stage pipelines with bash commands set in parentheses
for i in {1..10}
do
bash -c '
TIMEFORMAT=%3R
time (
printf "%d\n" {1..10000} \
| while read; do echo $REPLY done > /dev/null;
)
'
done \
|& mawk '{ sum += $1 }; END { print sum / NR }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment