Improving syntax for bash scripts

This commit is contained in:
Roy Lenferink
2019-01-18 19:17:16 +01:00
parent 31e4ece51f
commit a5d0616bdc
13 changed files with 89 additions and 89 deletions

View File

@@ -57,10 +57,10 @@ kube::log::install_errexit() {
kube::log::stack() {
local stack_skip=${1:-0}
stack_skip=$((stack_skip + 1))
if [[ ${#FUNCNAME[@]} -gt $stack_skip ]]; then
if [[ ${#FUNCNAME[@]} -gt ${stack_skip} ]]; then
echo "Call stack:" >&2
local i
for ((i=1 ; i <= ${#FUNCNAME[@]} - $stack_skip ; i++))
for ((i=1 ; i <= ${#FUNCNAME[@]} - ${stack_skip} ; i++))
do
local frame_no=$((i - 1 + stack_skip))
local source_file=${BASH_SOURCE[$frame_no]}
@@ -90,7 +90,7 @@ kube::log::error_exit() {
echo " ${1}" >&2
}
kube::log::stack $stack_skip
kube::log::stack ${stack_skip}
echo "Exiting with status ${code}" >&2
fi
@@ -130,7 +130,7 @@ kube::log::usage_from_stdin() {
# Print out some info that isn't a top level status line
kube::log::info() {
local V="${V:-0}"
if [[ $KUBE_VERBOSE < $V ]]; then
if [[ ${KUBE_VERBOSE} < ${V} ]]; then
return
fi
@@ -158,7 +158,7 @@ kube::log::info_from_stdin() {
# Print a status line. Formatted to show up in a stream of output.
kube::log::status() {
local V="${V:-0}"
if [[ $KUBE_VERBOSE < $V ]]; then
if [[ ${KUBE_VERBOSE} < ${V} ]]; then
return
fi