From b5c571df188cb095f3387f35bb375d026a5d18c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Sun, 21 Jun 2015 23:03:34 +0200 Subject: [PATCH] shellcheck fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- tests/1_host_configuration.sh | 2 +- tests/5_container_runtime.sh | 2 +- tests/6_docker_security_operations.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/1_host_configuration.sh b/tests/1_host_configuration.sh index d97a1ba..35188e6 100644 --- a/tests/1_host_configuration.sh +++ b/tests/1_host_configuration.sh @@ -40,7 +40,7 @@ fi # 1.6 check_1_6="1.6 - Keep Docker up to date" docker_version=$(docker version | grep 'Server version' | awk '{print $3}') -do_version_check 1.6.2 $docker_version +do_version_check 1.6.2 "$docker_version" if [ $? -eq 11 ]; then warn "$check_1_6" else diff --git a/tests/5_container_runtime.sh b/tests/5_container_runtime.sh index 9f581bf..7284249 100644 --- a/tests/5_container_runtime.sh +++ b/tests/5_container_runtime.sh @@ -180,7 +180,7 @@ else fi processes=$(docker exec "$c" ps -el 2>/dev/null | grep -c sshd | awk '{print $1}') - if [ $processes -gt 1 ]; then + if [ "$processes" -gt 1 ]; then # If it's the first container, fail the test if [ $fail -eq 0 ]; then warn "$check_5_7" diff --git a/tests/6_docker_security_operations.sh b/tests/6_docker_security_operations.sh index 3165986..28d6916 100644 --- a/tests/6_docker_security_operations.sh +++ b/tests/6_docker_security_operations.sh @@ -40,7 +40,7 @@ images=$(docker images -q | wc -l | awk '{print $1}') active_images=0 for c in $(docker inspect -f "{{.Image}}" $(docker ps -qa)); do - if docker images --no-trunc -a | grep $c > /dev/null ; then + if docker images --no-trunc -a | grep "$c" > /dev/null ; then active_images=$(( active_images += 1 )) fi done @@ -61,7 +61,7 @@ fi check_6_7="6.7 - Avoid container sprawl" total_containers=$(docker info 2>/dev/null | grep "Containers" | awk '{print $2}') running_containers=$(docker ps -q | wc -l | awk '{print $1}') -diff="$(($total_containers - $running_containers))" +diff="$((total_containers - running_containers))" if [ "$diff" -gt 25 ]; then warn "$check_6_7" warn " * There are currently a total of $total_containers containers, with only $running_containers of them currently running"