[libvirt PATCH 6/7] ci: integration.sh: Replace 'test' with '[' operator

Erik Skultety posted 7 patches 3 years ago
[libvirt PATCH 6/7] ci: integration.sh: Replace 'test' with '[' operator
Posted by Erik Skultety 3 years ago
Since we now have a standalone script instead of inlined shell commands
in a YAML, we can adopt the common syntax for if-then-else clauses
which involve the '[' test command alias rather than keep using 'test'
explicitly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 ci/integration.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ci/integration.sh b/ci/integration.sh
index cbd55d4253..41326d6e40 100644
--- a/ci/integration.sh
+++ b/ci/integration.sh
@@ -15,7 +15,7 @@ systemctl daemon-reexec
 # Source the os-release file to query the vendor-provided variables
 source /etc/os-release
 
-if test "$ID" = "centos" && test "$VERSION_ID" -eq 8
+if [ "$ID" = "centos" ] && [ "$VERSION_ID" -eq 8 ]
 then
     DAEMONS="libvirtd virtlockd virtlogd"
 else
-- 
2.39.0
Re: [libvirt PATCH 6/7] ci: integration.sh: Replace 'test' with '[' operator
Posted by Martin Kletzander 3 years ago
On Fri, Jan 20, 2023 at 04:06:02PM +0100, Erik Skultety wrote:
>Since we now have a standalone script instead of inlined shell commands
>in a YAML, we can adopt the common syntax for if-then-else clauses
>which involve the '[' test command alias rather than keep using 'test'
>explicitly.
>
>Signed-off-by: Erik Skultety <eskultet@redhat.com>
>---
> ci/integration.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/ci/integration.sh b/ci/integration.sh
>index cbd55d4253..41326d6e40 100644
>--- a/ci/integration.sh
>+++ b/ci/integration.sh
>@@ -15,7 +15,7 @@ systemctl daemon-reexec
> # Source the os-release file to query the vendor-provided variables
> source /etc/os-release
>
>-if test "$ID" = "centos" && test "$VERSION_ID" -eq 8
>+if [ "$ID" = "centos" ] && [ "$VERSION_ID" -eq 8 ]

Or simply:

if [ "$ID" = "centos" -a "$VERSION_ID" -eq 8 ]

> then
>     DAEMONS="libvirtd virtlockd virtlogd"
> else
>-- 
>2.39.0
>