You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logError "One argument needs to be passed to printVersion, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:""$#"
63
+
if(($#!=1))&&(($#!=2));then
64
+
logError "Either one or two arguments needs to be passed to printVersion, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:""$#"
64
65
echo>&2'1: version the version which shall be shown if one uses --version'
65
-
echo>&2'2: stackFrame number of frames to drop to determine the source of the call'
66
+
echo>&2'2: stackFrame number of frames to drop to determine the source of the call -- default 3'
66
67
printStackTrace
67
68
exit 9
68
69
fi
69
70
local version=$1
70
71
local stackFrame=${2:-3}
71
-
logInfo "Version of %s is:\n%s""$(basename "${BASH_SOURCE[stackFrame]:-${BASH_SOURCE[((stackFrame-1))]}}")""$version"
72
+
logInfo "Version of %s is:\n%s""$(basename "${BASH_SOURCE[stackFrame]:-${BASH_SOURCE[((stackFrame - 1))]}}")""$version"
73
+
}
74
+
75
+
functionassignToVariableInOuterScope() {
76
+
if(($#!=2));then
77
+
logError "Exactly two arguments needs to be passed to assignToOuterScopeVariable, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:""$#"
78
+
echo>&2'1: variableName the name of the variable in the outer scope to which the given value shall be assigned'
79
+
echo>&2'2: value the value which shall be assigned to the variable'
80
+
printStackTrace
81
+
exit 9
82
+
fi
83
+
exitIfVariablesNotDeclared "$1"
84
+
# that's where the black magic happens, we are assigning to global (not local to this function) variables here
85
+
printf -v "$1""%s""$2"|| traceAndDie "could not assign value to %s""$1"
0 commit comments