diff mbox series

[v2] configure: silence 'shift' error message in version_ge()

Message ID 20200821163312.98184-1-sgarzare@redhat.com
State Superseded
Headers show
Series [v2] configure: silence 'shift' error message in version_ge() | expand

Commit Message

Stefano Garzarella Aug. 21, 2020, 4:33 p.m. UTC
If there are less than 2 arguments in version_ge(), the second
'shift' prints this error:
    ../configure: line 232: shift: shift count out of range

Let's skip it if there are no more arguments.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
v2:
- do not shift if there are no more arguments [Peter]
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/configure b/configure
index 4e5fe33211..5f5f370e2c 100755
--- a/configure
+++ b/configure
@@ -229,7 +229,7 @@  version_ge () {
         set x $local_ver1
         local_first=${2-0}
         # shift 2 does nothing if there are less than 2 arguments
-        shift; shift
+        shift; test $# -gt 0 && shift
         local_ver1=$*
         set x $local_ver2
         # the second argument finished, the first must be greater or equal