scripts: factor out benchmarks and run further with ./eeval and common_bench_cmd

This commit is contained in:
Ciro Santilli
2018-04-18 12:26:41 +01:00
parent 96090a4c24
commit f4eed4163b
7 changed files with 52 additions and 20 deletions

18
eeval
View File

@@ -1,4 +1,20 @@
#!/usr/bin/env bash
# echo and eval
a=
while getopts a OPT; do
case "$OPT" in
a)
# Append to file instead of overwriting.
a=-a
;;
?)
exit 2
;;
esac
done
shift "$(($OPTIND - 1))"
cmd="$1"
echo "$cmd" | tee -a "${2:-/dev/null}"
outfile="${2:-/dev/null}"
echo "$cmd" | tee $a "$outfile"
eval "$cmd"
exit "$?"