diff --git a/tests/shtest b/tests/shtest index dd007d153c..6ecadaa967 100755 --- a/tests/shtest +++ b/tests/shtest @@ -566,15 +566,18 @@ if ! $VALGRIND $Q $JQ -n -f "$JQTESTDIR/yes-main-program.jq" > $d/out 2>&1; then exit 1 fi -if ( ! $msys && ! $mingw ) && locale -a > /dev/null; then - locale=$(locale -a | egrep -v '^(C|LANG|POSIX|en)' | egrep -i 'utf8|utf-8' | head -1) - if [ -z "$locale" ]; then +if ! $msys && ! $mingw && locales=$(locale -a); then + { l=$(grep -Ev '^(C|LANG|POSIX|en)' | grep -Ei '\.utf-?8$' | head -n1) ;} \ +<