configure: silence 'shift' error message in version_ge()
PATCH v2 1/1 configure: silence 'shift' error message in version_ge()
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.
---
v2:
- do not shift if there are no more arguments [Peter]
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -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
Signature · 1 line
2.26.2
Quoted 20 lines · Stefano Garzarella
If there are less than 2 arguments in
version_ge(), the second 'shift' prints this error:
../configure: line 232: shift: shift count out of rangeLet's skip it if there are no more arguments.
Signed-off-by Stefano Garzarella <[email protected]>---
v2:
- do not shift if there are no more arguments [Peter]--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure +0
-0
configure version_ge () { · line 235
Quoted 8 lines
configure +1
-1@@ -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
Quoted 19 lines · Stefano Garzarella
If there are less than 2 arguments in
version_ge(), the second 'shift' prints this error:
../configure: line 232: shift: shift count out of rangeLet's skip it if there are no more arguments.
Signed-off-by Stefano Garzarella <[email protected]>---
v2:
- do not shift if there are no more arguments [Peter]--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure +0
-0
configure version_ge () { · line 232
Quoted 5 lines
configure +1
-1@@ -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
That works. Or you could go with the shorter one-liner:
shift ${2:+2}
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 29 lines · Eric Blake
Quoted 19 lines · Stefano Garzarella
If there are less than 2 arguments in
version_ge(), the second 'shift' prints this error:
../configure: line 232: shift: shift count out of rangeLet's skip it if there are no more arguments.
Signed-off-by Stefano Garzarella <[email protected]>---
v2:
- do not shift if there are no more arguments [Peter]--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure +0
-0configure version_ge () { · line 232
Quoted 5 lines
configure +1
-1@@ -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 && shiftThat works. Or you could go with the shorter one-liner:
Quoted 1 line
shift ${2:+2}
yeah, it is better!
I'll send v3.
Thanks,
Stefano