This confuses the shell because handling variables with spaces
in them is horrible.
# Strip leading and trailing "s.
function config_strip() {
- local var=${1}
+ local var="$@"
+
+ # Do nothing for strings that contain spaces.
+ if contains_spaces ${var}; then
+ print "${var}"
+ return ${EXIT_OK}
+ fi
if [ "${var:0:1}" = "\"" ]; then
var=${var:1}
cmd $@ &>/dev/null
}
+function cmd_exec() {
+ local cmd=$@
+
+ log DEBUG "Exec'ing command: ${cmd}"
+
+ exec ${cmd}
+
+ log ERROR "Could not exec-ute: ${cmd}"
+ exit ${EXIT_ERROR}
+}
+
function seq() {
if [ $# -eq 2 ]; then
eval echo {${1}..${2}}
# Check, if the network service is running.
service_is_active network
}
+
+function contains_spaces() {
+ local var="$@"
+
+ # Eliminate spaces.
+ local var2=${var// /}
+
+ if [ ${#var} -ne ${#var2} ]; then
+ return ${EXIT_TRUE}
+ fi
+
+ return ${EXIT_FALSE}
+}