Mercurial > hg > octave-nkf > gnulib-hg
changeset 12869:f95da3d36673
init.sh: improve portability and efficiency
* tests/init.sh (find_exe_basenames_): Remove unnecessary use of
"dummy" in a for loop.
Use '!', not '^' to select the complement of a character set used
in a "case" statement.
Use shell variable manipulation, a la ${...%.exe}, rather than sed.
Suggestions from Eric Blake.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Sat, 13 Feb 2010 15:51:37 +0100 |
parents | 6a639f241abd |
children | e72f3991a813 |
files | tests/init.sh |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/init.sh +++ b/tests/init.sh @@ -102,12 +102,13 @@ feb_fail_=0 feb_result_= feb_sp_= - for feb_file_ in $feb_dir_/*.exe dummy; do + for feb_file_ in $feb_dir_/*.exe; do case $feb_file_ in - dummy) continue;; - *[^-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; - *) feb_file_=$(echo $feb_file_ | sed "s,^$feb_dir_/,,;"'s/\.exe$//') - feb_result_="$feb_result_$feb_sp_$feb_file_";; + *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; + *) # Remove leading file name components as well as the .exe suffix. + feb_file_=${feb_file_##*/} + feb_file_=${feb_file_%.exe} + feb_result_="$feb_result_$feb_sp_$feb_file_";; esac feb_sp_=' ' done @@ -129,7 +130,7 @@ esac base_names_=$(find_exe_basenames_ $1) \ - || { echo "$0 (exe-shim): skipping directory: $1" 1>&2; return 1; } + || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; } if test -n "$base_names_"; then for base_ in $base_names_; do