X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=dracut-functions.sh;fp=dracut-functions.sh;h=280e4e782373d94bf81d01b32ef20becbd2d9089;hb=b4de9ee107742c8b0b8a86dcc22aa4fd366b068e;hp=6ab31aa87182c52a1c7f0216b7592b6131933e85;hpb=e877be69b41199ee4384ccb6352754bb9edfbba4;p=thirdparty%2Fdracut.git diff --git a/dracut-functions.sh b/dracut-functions.sh index 6ab31aa87..280e4e782 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -37,6 +37,13 @@ str_starts() { [ "${1#"$2"*}" != "$1" ]; } # returns OK if $1 contains literal string $2 at the end, and isn't empty str_ends() { [ "${1%*"$2"}" != "$1" ]; } +trim() { + local var="$*" + var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters + var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters + printf "%s" "$var" +} + # find a binary. If we were not passed the full path directly, # search in the usual places to find the binary. find_binary() {