Fix ShellCheck warnings

This change fixes all problems reported by ShellCheck [1] which is a
nice linting tool for sh/bash scripts.

[1] http://www.shellcheck.net/about.html

Change-Id: I7104597e309fed5a4d52f5fc39ab0f4350fb3217
This commit is contained in:
Simon Pasquier
2015-05-05 16:42:11 +02:00
parent e6c0b44eb0
commit d7c011d613
6 changed files with 53 additions and 52 deletions

11
contrib/common/functions.sh Normal file → Executable file
View File

@@ -16,20 +16,21 @@
set -e
function docker_pull_image {
if [[ "$( docker images -q ${1})" == "" ]]; then
docker pull ${1}
if [[ $(docker images -q "${1}") == "" ]]; then
docker pull "${1}"
fi
}
function docker_get_id {
echo $(docker inspect --format="{{ .Id }}" ${1} 2>/dev/null)
docker inspect --format="{{ .Id }}" "${1}" 2>/dev/null
}
function docker_is_running {
local IS_RUNNING=$(docker inspect --format="{{ .State.Running }}" ${1} 2>/dev/null)
local IS_RUNNING
IS_RUNNING=$(docker inspect --format="{{ .State.Running }}" "${1}" 2>/dev/null)
[[ "${IS_RUNNING}" == "true" ]]
}
function docker_shorten_id {
echo ${1} | cut -c 1-12
echo "${1}" | cut -c 1-12
}