improved code quality, few bug fixes
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
# ------------------------------------------------------------------------------
|
||||
# Various utilitary functions
|
||||
# This file is part of the init.sh project
|
||||
@@ -25,7 +26,7 @@ function_exists() {
|
||||
die 11 --force
|
||||
fi
|
||||
|
||||
if [[ $(LC_ALL=C type -t $1 | grep function) ]]; then
|
||||
if [[ -n $(LC_ALL=C type -t $1 | grep function) ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -42,7 +43,7 @@ get_mod_name()
|
||||
prnt E "get_mod_name(): Bad number of parameters."
|
||||
die 11 --force
|
||||
fi
|
||||
echo $(basename $1 | cut -f 1 -d '.')
|
||||
basename $1 | cut -f 1 -d '.'
|
||||
}
|
||||
export -f get_mod_name
|
||||
|
||||
@@ -52,7 +53,7 @@ export -f get_mod_name
|
||||
trim()
|
||||
{
|
||||
local string="$@"
|
||||
echo "$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'<<<"${string}")"
|
||||
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'<<<"${string}"
|
||||
unset string
|
||||
}
|
||||
export -f trim
|
||||
|
||||
Reference in New Issue
Block a user