Reorganize helpers

This commit is contained in:
2013-10-03 23:42:20 +01:00
parent 1f2373bab3
commit 4b84e35b2f
6 changed files with 3 additions and 3 deletions

13
src/lib/helpers/trim.sh Normal file
View File

@@ -0,0 +1,13 @@
# Trim leading and trailing whitespace.
#
# Example:
#
# $ trim " foo bar "
# foo bar
#
trim() {
local string="$@"
string="${string#"${string%%[![:space:]]*}"}"
string="${string%"${string##*[![:space:]]}"}"
echo -n "$string"
}