dracut-lib: add str_ends, to go along with str_starts

master
Will Woods 2012-04-05 13:01:35 -04:00 committed by Harald Hoyer
parent 76c14799da
commit d8f0e320c2
1 changed files with 5 additions and 0 deletions

View File

@ -12,6 +12,11 @@ str_starts() {
[ "${1#$2*}" != "$1" ] [ "${1#$2*}" != "$1" ]
} }


# returns OK if $1 contains $2 at the end
str_ends() {
[ "${1%*$2}" != "$1" ]
}

# replaces all occurrences of 'search' in 'str' with 'replacement' # replaces all occurrences of 'search' in 'str' with 'replacement'
# #
# str_replace str search replacement # str_replace str search replacement