]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Avoid unneeded use of awk in xzless.
authorLasse Collin <lasse.collin@tukaani.org>
Tue, 5 Mar 2013 17:14:50 +0000 (19:14 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 5 Apr 2013 16:28:08 +0000 (19:28 +0300)
Use "read" instead of "awk" in xzless to get the version
number of "less". The need for awk was introduced in
the commit db5c1817fabf7cbb9e4087b1576eb26f0747338e.

Thanks to Ariel P for the patch.

src/scripts/xzless.in

index 9bc9706b511f3c9dd159d16400dbb26679bb5829..288dd871e4c48b3f098d9ba066af767c5e697c84 100644 (file)
@@ -46,8 +46,7 @@ if test "${LESSMETACHARS+set}" != set; then
        LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
 fi
 
-less_ver=$(less -V | awk '/^less ([0-9]+)( \(.*\))?$/ { print $2; exit }')
-if test -n "$less_ver" && test "$less_ver" -ge 429; then
+if test "$(less -V | { read less ver re && echo ${ver}; })" -ge 429; then
        # less 429 or later: LESSOPEN pipe will be used on
        # standard input if $LESSOPEN begins with |-.
        LESSOPEN="|-$xz -cdfq -- %s"