aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2013-03-05 19:14:50 +0200
committerLasse Collin <lasse.collin@tukaani.org>2013-04-05 19:28:08 +0300
commit211b931cee58626c1d2e021810cb108cb5cbc10f (patch)
treeb52bf78b0f05eedbf075da10519cb6adb3a68c10
parentxzless: Make "less -V" parsing more robust (diff)
downloadxz-211b931cee58626c1d2e021810cb108cb5cbc10f.tar.xz
Avoid unneeded use of awk in xzless.
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.
Diffstat (limited to '')
-rw-r--r--src/scripts/xzless.in3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/scripts/xzless.in b/src/scripts/xzless.in
index 9bc9706b..288dd871 100644
--- a/src/scripts/xzless.in
+++ b/src/scripts/xzless.in
@@ -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"