base/dracut-lib.sh: add trim()
trim() to remove leading and trailing whitespace
(cherry picked from commit ac422d577c)
master
parent
0cf826a11a
commit
2949dcba29
|
|
@ -51,6 +51,13 @@ str_ends() {
|
|||
[ "${1%*"$2"}" != "$1" ]
|
||||
}
|
||||
|
||||
trim() {
|
||||
local var="$*"
|
||||
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||
echo -n "$var"
|
||||
}
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
|
||||
warn() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue