diff --git a/evaluation/intro/hello-world-bash.sh b/evaluation/intro/hello-world-bash.sh new file mode 100755 index 000000000..5cf3a628f --- /dev/null +++ b/evaluation/intro/hello-world-bash.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# uses bashisms to demonstrate pa.sh bash support + +[[ $(uname) = 'Darwin' ]] && a=/usr/share/dict/web2 || a=/usr/share/dict/words + +pattern=('\(.\).*\1\(.\).*\2\(.\).*\3\(.\).*\4') + +if [[ -f $a ]]; then + cat "$a"{,,,,,,,,} | grep "${pattern[@]}" | wc -l +else + echo "Dictionary file $a not found.." +fi + diff --git a/evaluation/intro/test.sh b/evaluation/intro/test.sh index 4bcefb167..5657ad39d 100755 --- a/evaluation/intro/test.sh +++ b/evaluation/intro/test.sh @@ -15,12 +15,13 @@ mkdir -p "$output_dir" run_test() { local test=$1 + local args="$2" echo -n "Running $test..." TIMEFORMAT="${test%%.*}:%3R" # %3U %3S" { time $bash "$test" > "$output_dir/$test.bash.out"; } 2> >(tee -a $output_dir/results.time_bash) test_bash_ec=$? TIMEFORMAT="%3R" # %3U %3S" - { time $pash "$test" > "$output_dir/$test.pash.out"; } 2> >(tee -a $output_dir/results.time_pash) + { time $pash $args "$test" > "$output_dir/$test.pash.out"; } 2> >(tee -a $output_dir/results.time_pash) test_pash_ec=$? diff "$output_dir/$test.bash.out" "$output_dir/$test.pash.out" test_diff_ec=$? @@ -59,6 +60,7 @@ run_test() run_test "demo-spell.sh" run_test "hello-world.sh" +run_test "hello-world-bash.sh" "--bash" if type lsb_release >/dev/null 2>&1 ; then distro=$(lsb_release -i -s)