mirror of
https://github.com/jimeh/dotify.git
synced 2026-02-19 10:06:39 +00:00
Reorganize helpers
This commit is contained in:
13
src/lib/helpers/trim.sh
Normal file
13
src/lib/helpers/trim.sh
Normal 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"
|
||||
}
|
||||
Reference in New Issue
Block a user