diff --git a/configure b/configure
index e1efb3ca0cca..dd9d36199194 100755
--- a/configure
+++ b/configure
@@ -130,17 +130,15 @@ fi
 cat << EOF > lib-test.c
 __UINT32_TYPE__
 EOF
-u32_long=$($cross_prefix$cc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
+u32_long=$("$cross_prefix$cc" -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
 rm -f lib-test.c
 
 # api/: check for dependent 32 bit libraries and gnu++11 support
 if [ "$testdir" = "x86" ]; then
     echo 'int main () {}' > lib-test.c
-    $cc -m32 -o /dev/null -lstdc++ -lpthread -lrt lib-test.c &> /dev/null
-    exit=$?
-    $cxx -m32 -o /dev/null -std=gnu++11 lib-test.c &> /dev/null
-    if [ $? -eq 0 -a $exit -eq 0 ]; then
-        api=true
+    if $cc -m32 -o /dev/null -lstdc++ -lpthread -lrt lib-test.c &> /dev/null &&
+       $cxx -m32 -o /dev/null -std=gnu++11 lib-test.c &> /dev/null; then
+        api=yes
     fi
     rm -f lib-test.c
 fi
@@ -163,7 +161,7 @@ fi
 
 # link lib/asm for the architecture
 rm -f lib/asm
-asm=asm-generic
+asm="asm-generic"
 if [ -d "$srcdir/lib/$arch/asm" ]; then
 	asm="$srcdir/lib/$arch/asm"
 elif [ -d "$srcdir/lib/$testdir/asm" ]; then
diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 5249e8d87715..28a9efa9bf95 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -28,7 +28,7 @@ run_qemu ()
 {
 	local stdout errors ret sig
 
-	echo -n $@
+	echo -n "$@"
 	initrd_create &&
 		echo -n " #"
 	echo " $INITRD"
@@ -107,7 +107,7 @@ qmp ()
 run_migration ()
 {
 	if ! command -v nc >/dev/null 2>&1; then
-		echo "$FUNCNAME needs nc (netcat)" >&2
+		echo "${FUNCNAME[0]} needs nc (netcat)" >&2
 		exit 2
 	fi
 
@@ -229,8 +229,8 @@ env_generate_errata ()
 	local kernel_version kernel_patchlevel kernel_sublevel kernel_extraversion
 	local line commit minver errata rest v p s x have
 
-	IFS=. read kernel_version kernel_patchlevel rest <<<$kernel_version_string
-	IFS=- read kernel_sublevel kernel_extraversion <<<$rest
+	IFS=. read -r kernel_version kernel_patchlevel rest <<<$kernel_version_string
+	IFS=- read -r kernel_sublevel kernel_extraversion <<<$rest
 	kernel_sublevel=${kernel_sublevel%%[!0-9]*}
 	kernel_extraversion=${kernel_extraversion%%[!0-9]*}
 
@@ -247,8 +247,8 @@ env_generate_errata ()
 		errata="ERRATA_$commit"
 		test -v $errata && continue
 
-		IFS=. read v p rest <<<$minver
-		IFS=- read s x <<<$rest
+		IFS=. read -r v p rest <<<$minver
+		IFS=- read -r s x <<<$rest
 		s=${s%%[!0-9]*}
 		x=${x%%[!0-9]*}
 
@@ -305,8 +305,8 @@ kvm_available ()
 		return 1
 
 	[ "$HOST" = "$ARCH_NAME" ] ||
-		[ "$HOST" = aarch64 -a "$ARCH" = arm ] ||
-		[ "$HOST" = x86_64 -a "$ARCH" = i386 ]
+		( [ "$HOST" = aarch64 ] && [ "$ARCH" = arm ] ) ||
+		( [ "$HOST" = x86_64 ] && [ "$ARCH" = i386 ] )
 }
 
 get_qemu_accelerator ()
diff --git a/scripts/common.bash b/scripts/common.bash
index ee9143c5d630..9a6ebbd7f287 100644
--- a/scripts/common.bash
+++ b/scripts/common.bash
@@ -15,7 +15,7 @@ function for_each_unittest()
 
 	exec {fd}<"$unittests"
 
-	while read -u $fd line; do
+	while read -r -u $fd line; do
 		if [[ "$line" =~ ^\[(.*)\]$ ]]; then
 			"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
 			testname=${BASH_REMATCH[1]}
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index ac09e0fd30ac..a31ae913c8c8 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -38,7 +38,7 @@ skip_nodefault()
     [ "$STANDALONE" != "yes" ] && return 0
 
     while true; do
-        read -p "Test marked not to be run by default, are you sure (y/N)? " yn
+        read -r -p "Test marked not to be run by default, are you sure (y/N)? " yn
         case $yn in
             "Y" | "y" | "Yes" | "yes")
                 return 1
@@ -84,7 +84,7 @@ function run()
     # check a file for a particular value before running a test
     # the check line can contain multiple files to check separated by a space
     # but each check parameter needs to be of the form <path>=<value>
-    for check_param in ${check[@]}; do
+    for check_param in "${check[@]}"; do
         path=${check_param%%=*}
         value=${check_param#*=}
         if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then
diff --git a/x86/run b/x86/run
index e59c6c590a20..1ac91f1d880f 100755
--- a/x86/run
+++ b/x86/run
@@ -37,7 +37,7 @@ else
 	pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out"
 fi
 
-command="${qemu} -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev $hyperv_testdev"
+command="${qemu} -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev"
 command+=" -machine accel=$ACCEL -kernel"
 command="$(timeout_cmd) $command"
 
