From 29b0a936ce8724567979dd1edbebea9188debd3a Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 3 Jun 2020 11:57:11 +0200 Subject: xdt-autogen: Improve and simplify linguas detection The `ls *.po | awk ..` pattern is generally not recommended[0]. Replace it with a tiny for loop with basename. Use POSIX `tr`[1] to delete the trailing end-of-line, since `echo -n` is not specified in POSIX[2]. This also removes the need for awk check. [0]: https://github.com/koalaman/shellcheck/wiki/SC2012#rationale [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/tr.html [2]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html --- scripts/xdt-autogen.in | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'scripts') diff --git a/scripts/xdt-autogen.in b/scripts/xdt-autogen.in index 6cd3d4f..222ed3f 100644 --- a/scripts/xdt-autogen.in +++ b/scripts/xdt-autogen.in @@ -44,25 +44,6 @@ if test -z "$EGREP"; then fi fi -awk_tests="gawk mawk nawk awk" -if test -z "$AWK"; then - for a in $awk_tests; do - if type $a >/dev/null 2>&1; then - AWK=$a - break - fi - done -else - if ! type $AWK >/dev/null 2>/dev/null; then - unset AWK - fi -fi -if test -z "$AWK"; then - echo "xdt-autogen: The 'awk' program (one of $awk_tests) is" >&2 - echo " required, but cannot be found." >&2 - exit 1 -fi - ## ## figures out any subdirs that should be configured as a part ## of recursive configure. @@ -194,7 +175,7 @@ for configure_ac_in_file in $CONFIGURE_AC_IN_FILES; do # find out what languages we support conf_dir=`dirname $configure_ac_file` - linguas=`cd "$conf_dir/po" 2>/dev/null && ls *.po 2>/dev/null | $AWK 'BEGIN { FS="."; ORS=" " } { print $1 }'` + linguas=$(echo $(for i in "$conf_dir"/po/*.po; do test -e "$i" && basename -- "$i" .po; done) | tr -d '\n') # and do the substitution tmp=`basename ${configure_ac_in_file}` -- cgit v1.2.1