surround ALL variables with {}
This commit is contained in:
parent
6593dabf42
commit
d6e4ca0973
4 changed files with 15 additions and 14 deletions
|
@ -5,6 +5,6 @@ function attach() {
|
|||
log e "Container '${1}' is not running!"
|
||||
exit 1
|
||||
fi
|
||||
log i "Attaching to container '$1'"
|
||||
podman container attach "$1"
|
||||
log i "Attaching to container '${1}'"
|
||||
podman container attach "${1}"
|
||||
}
|
||||
|
|
|
@ -19,5 +19,5 @@ function delete() {
|
|||
done
|
||||
|
||||
rm -rf "$delDir"
|
||||
log s "Server '$1' deleted!"
|
||||
log s "Server '${1}' deleted!"
|
||||
}
|
||||
|
|
|
@ -15,40 +15,41 @@ readonly RESET="\033[0m"
|
|||
function log() {
|
||||
local prefix
|
||||
|
||||
type=$1
|
||||
type=${1}
|
||||
print=false
|
||||
shift
|
||||
message=$@
|
||||
case $type in
|
||||
case ${type} in
|
||||
"s")
|
||||
print=true
|
||||
prefix="${GREEN}[SUCCESS]${RESET}"
|
||||
;;
|
||||
"d")
|
||||
if [[ "$debuglevel" -ge 4 ]]; then
|
||||
if [[ "${debuglevel}" -ge 4 ]]; then
|
||||
print=true
|
||||
fi
|
||||
prefix="${MAGENTA}[DEBUG]${RESET}"
|
||||
;;
|
||||
"i")
|
||||
if [[ "$debuglevel" -ge 1 ]]; then
|
||||
if [[ "${debuglevel}" -ge 1 ]]; then
|
||||
print=true
|
||||
fi
|
||||
prefix="${BLUE}[INFO]${RESET}"
|
||||
;;
|
||||
"w")
|
||||
if [[ "$debuglevel" -ge 2 ]]; then
|
||||
if [[ "${debuglevel}" -ge 2 ]]; then
|
||||
print=true
|
||||
fi
|
||||
prefix="${YELLOW}[WARN]${RESET}"
|
||||
;;
|
||||
"e")
|
||||
if [[ "$debuglevel" -ge 3 ]]; then
|
||||
if [[ "${debuglevel}" -ge 3 ]]; then
|
||||
print=true
|
||||
fi
|
||||
prefix="${RED}[ERR]${RESET}"
|
||||
;;
|
||||
esac
|
||||
|
||||
"$print" && echo -e "$prefix $message"
|
||||
"${print}" && echo -e "${prefix} ${message}"
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function stop() {
|
||||
if [[ -z $(podman container ps | grep "$1") ]]; then
|
||||
log w "Container '$1' is not running!"
|
||||
if [[ -z $(podman container ps | grep "${1}") ]]; then
|
||||
log w "Container '${1}' is not running!"
|
||||
return 1
|
||||
fi
|
||||
log i "Stopping container '$1'"
|
||||
stopContainer "$1"
|
||||
log i "Stopping container '${1}'"
|
||||
stopContainer "${1}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue