Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- # Function: trim
- # Description: Trims any/all whitespace from the beginning and end of a string
- # Arguments: $1 :- The string from which to trim whitespace
- # Outputs: Prints string with any leading/trailing whitespace removed
- function trim {
- local str="$1"
- str="${str#"${str%%[![:space:]]*}"}"
- str="${str%"${str##*[![:space:]]}"}"
- echo "$1"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement