diff --git a/ChangeLog b/ChangeLog index 77f89ab..c3249bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ * dejagnu (command): Use Awk instead of non-portable basename(1) and a non-portable sed(1) pattern to initially set this variable. + * dejagnu: Use shell "case" pattern match instead of non-portable + "grep -q" to determine if "awk" is GNU Awk. + 2021-04-15 Jacob Bachmeyer PR47382 diff --git a/dejagnu b/dejagnu index c38dd4d..57767b1 100755 --- a/dejagnu +++ b/dejagnu @@ -248,11 +248,10 @@ if $have_gawk ; then fi # is "awk" actually GNU Awk? if $have_awk ; then - if "$awkbin" --version | sed 1q | grep -qi 'GNU Awk' ; then - have_gawk_as_awk=true - else - have_gawk_as_awk=false - fi + case `"$awkbin" --version 2>&1 | sed 1q` in + *'GNU Awk'*) have_gawk_as_awk=true ;; + *) have_gawk_as_awk=false ;; + esac fi if expr "$verbose" \> 2 > /dev/null ; then if $have_awk ; then