Skip to content

Commit

Permalink
shellcheck
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
  • Loading branch information
konstruktoid committed Oct 16, 2019
1 parent bf42355 commit ddad135
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docker-bench-security.sh
Expand Up @@ -101,7 +101,7 @@ main () {
benchcont="$c"
fi
done

# get the image id of the docker_bench_security_image, memorize it:
benchimagecont="nil"
for c in $(docker images | sed '1d' | awk '{print $3}'); do
Expand Down
2 changes: 1 addition & 1 deletion output_lib.sh
@@ -1,6 +1,6 @@
#!/bin/sh

if ! [ -z "$nocolor" ] && [ "$nocolor" = "nocolor" ]; then
if [ -n "$nocolor" ] && [ "$nocolor" = "nocolor" ]; then
bldred=''
bldgrn=''
bldblu=''
Expand Down
2 changes: 1 addition & 1 deletion tests/1_host_configuration.sh
Expand Up @@ -110,7 +110,7 @@ check_1_2_3() {
starttestjson "$id_1_2_3" "$desc_1_2_3"

totalChecks=$((totalChecks + 1))
file="/usr/bin/dockerd"
file="/usr/bin/dockerd"
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep "$file" >/dev/null 2>&1; then
pass "$check_1_2_3"
Expand Down
12 changes: 6 additions & 6 deletions tests/3_docker_daemon_configuration_files.sh
Expand Up @@ -255,7 +255,7 @@ check_3_9() {
starttestjson "$id_3_9" "$desc_3_9"

totalChecks=$((totalChecks + 1))
if ! [ -z $(get_docker_configuration_file_args 'tlscacert') ]; then
if [ -n "$(get_docker_configuration_file_args 'tlscacert')" ]; then
tlscacert=$(get_docker_configuration_file_args 'tlscacert')
else
tlscacert=$(get_docker_effective_command_line_args '--tlscacert' | sed -n 's/.*tlscacert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1)
Expand Down Expand Up @@ -287,7 +287,7 @@ check_3_10() {
starttestjson "$id_3_10" "$desc_3_10"

totalChecks=$((totalChecks + 1))
if ! [ -z $(get_docker_configuration_file_args 'tlscacert') ]; then
if [ -n "$(get_docker_configuration_file_args 'tlscacert')" ]; then
tlscacert=$(get_docker_configuration_file_args 'tlscacert')
else
tlscacert=$(get_docker_effective_command_line_args '--tlscacert' | sed -n 's/.*tlscacert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1)
Expand Down Expand Up @@ -319,7 +319,7 @@ check_3_11() {
starttestjson "$id_3_11" "$desc_3_11"

totalChecks=$((totalChecks + 1))
if ! [ -z $(get_docker_configuration_file_args 'tlscert') ]; then
if [ -n "$(get_docker_configuration_file_args 'tlscert')" ]; then
tlscert=$(get_docker_configuration_file_args 'tlscert')
else
tlscert=$(get_docker_effective_command_line_args '--tlscert' | sed -n 's/.*tlscert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1)
Expand Down Expand Up @@ -351,7 +351,7 @@ check_3_12() {
starttestjson "$id_3_12" "$desc_3_12"

totalChecks=$((totalChecks + 1))
if ! [ -z $(get_docker_configuration_file_args 'tlscert') ]; then
if [ -n "$(get_docker_configuration_file_args 'tlscert')" ]; then
tlscert=$(get_docker_configuration_file_args 'tlscert')
else
tlscert=$(get_docker_effective_command_line_args '--tlscert' | sed -n 's/.*tlscert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1)
Expand Down Expand Up @@ -383,7 +383,7 @@ check_3_13() {
starttestjson "$id_3_13" "$desc_3_13"

totalChecks=$((totalChecks + 1))
if ! [ -z $(get_docker_configuration_file_args 'tlskey') ]; then
if [ -n "$(get_docker_configuration_file_args 'tlskey')" ]; then
tlskey=$(get_docker_configuration_file_args 'tlskey')
else
tlskey=$(get_docker_effective_command_line_args '--tlskey' | sed -n 's/.*tlskey=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1)
Expand Down Expand Up @@ -415,7 +415,7 @@ check_3_14() {
starttestjson "$id_3_14" "$desc_3_14"

totalChecks=$((totalChecks + 1))
if ! [ -z $(get_docker_configuration_file_args 'tlskey') ]; then
if [ -n "$(get_docker_configuration_file_args 'tlskey')" ]; then
tlskey=$(get_docker_configuration_file_args 'tlskey')
else
tlskey=$(get_docker_effective_command_line_args '--tlskey' | sed -n 's/.*tlskey=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1)
Expand Down
4 changes: 2 additions & 2 deletions tests/5_container_runtime.sh
Expand Up @@ -332,7 +332,7 @@ check_5_7() {

# iterate through port range (line delimited)
for port in $ports; do
if [ ! -z "$port" ] && [ "$port" -lt 1024 ]; then
if [ -n "$port" ] && [ "$port" -lt 1024 ]; then
# If it's the first container, fail the test
if [ $fail -eq 0 ]; then
warn "$check_5_7"
Expand Down Expand Up @@ -1171,7 +1171,7 @@ check_5_29() {
pattern=$(echo "$exclude" | sed 's/,/|/g')
cName=$(docker inspect --format '{{.Name}}' "$c" 2>/dev/null | sed 's/\///g' | grep -Ev "$pattern" )
fi
if ! [ -z "$cName" ]; then
if [ -n "$cName" ]; then
info " * Container in docker0 network: $cName"
docker_network_containers="$docker_network_containers $c:$cName"
fi
Expand Down

0 comments on commit ddad135

Please sign in to comment.