Bash_Scripts/Templates/Functions/Trim.bash

17 lines
203 B
Bash
Executable File

#!/bin/bash
trim() {
local input="${1}"
while [[ "${input}" == " "* ]]; do
input="${input## }"
done
while [[ "${input}" == *" " ]]; do
input="${input%% }"
done
echo "${input}"
}