1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

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 db5c1817fa.

Thanks to Ariel P for the patch.
This commit is contained in:
Lasse Collin 2013-03-05 19:14:50 +02:00
parent 9f62fd9605
commit 211b931cee

View file

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