summaryrefslogtreecommitdiffstats
path: root/helper/string.inc
diff options
context:
space:
mode:
authorSimon Rettberg2013-02-21 16:15:53 +0100
committerSimon Rettberg2013-02-21 16:15:53 +0100
commit5df4333057e050587225d3aab9241d8035444f78 (patch)
tree83f1fee9b86e5d0ad6c33d570c6963c9b6df94fa /helper/string.inc
parentMerge branch 'master' of ssh://openslx/openslx-ng/tm-scripts (diff)
downloadtm-scripts-5df4333057e050587225d3aab9241d8035444f78.tar.gz
tm-scripts-5df4333057e050587225d3aab9241d8035444f78.tar.xz
tm-scripts-5df4333057e050587225d3aab9241d8035444f78.zip
Add add_user function to add users and groups to the system
Add qnd_exit to stop the entire mltk script from within a function
Diffstat (limited to 'helper/string.inc')
-rw-r--r--helper/string.inc9
1 files changed, 9 insertions, 0 deletions
diff --git a/helper/string.inc b/helper/string.inc
new file mode 100644
index 00000000..1d15b26e
--- /dev/null
+++ b/helper/string.inc
@@ -0,0 +1,9 @@
+
+# usage: VAR=$(trim " string ")
+trim() {
+ local var=$1
+ var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
+ var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
+ echo -n "$var"
+}
+