mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-04 18:52:38 +00:00
Improving syntax for bash scripts
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user