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:
11
contrib/common/functions.sh
Normal file → Executable file
11
contrib/common/functions.sh
Normal file → Executable 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user