diff options
Diffstat (limited to 'helper/string.inc')
-rw-r--r-- | helper/string.inc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/helper/string.inc b/helper/string.inc index 4c6b9778..75baf2ca 100644 --- a/helper/string.inc +++ b/helper/string.inc @@ -1,10 +1,10 @@ # 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" + local var=$1 + var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters + var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters + echo -n "$var" } # Inline version of trim, use when piping |