Files
dotify/src/lib/trim.sh
Jim Myhrberg 21a0f78f41 Break main dotify binary apart into smaller pieces for easier testing
The plan is to have a build script that will put together all files into
a single executable again for easy inclusion in your own
dotfiles. Breaking dotify apart simply makes it easier to work with and
test.
2013-06-26 21:25:26 +02:00

14 lines
242 B
Bash

# 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"
}