Thread (2 messages) 2 messages, 2 authors, 2016-06-15

Re: recent patch breaks the build ?

flat view

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:12

Nick Hengeveld [off-list ref] writes:
Assuming --vernum does work, is there a reasonable/portable way to
compare two hex values like 070801?
I would assume that it is always 6 lowercase hexdigits %06x when
supported, or showing nothing to stdout for ancient ones.

A horrible but probably portable way would be:

	case `(echo 070801; curl-config --vernum) 2>/dev/null |
        	sort -r | sed -ne 2p` in
	070801)
        	echo Happy ;;
        *)
        	echo Sad ;;
	esac

The obvious one is unfortunately not very portable:

	if test 070801 \< `curl-config --vernum`
        then
        	echo "Happy"
	else
        	echo "Sad"
	fi

This would work if your test is bash/dash-builtin.  The
following do not seem to know about '<' '>' string comparison:

	GNU /usr/bin/test from coreutils (version 5.2.1)
        OpenBSD shell builtin
        Solaris /usr/bin/test
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help