| 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Usage: |
| 4 | # benchmarks/compute/word_split.sh <function name> |
| 5 | |
| 6 | count_argv() { |
| 7 | echo "COUNT = $#" |
| 8 | } |
| 9 | |
| 10 | default_ifs() { |
| 11 | local filename=$1 |
| 12 | |
| 13 | count_argv $(cat $filename) |
| 14 | } |
| 15 | |
| 16 | other_ifs() { |
| 17 | local filename=$1 |
| 18 | |
| 19 | # whitespace and non-whitespace |
| 20 | export IFS=',: ' |
| 21 | count_argv $(cat $filename) |
| 22 | } |
| 23 | |
| 24 | "$@" |