From: Will Woods Date: Thu, 5 Apr 2012 17:01:35 +0000 (-0400) Subject: dracut-lib: add str_ends, to go along with str_starts X-Git-Tag: 019~118 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d8f0e320c267af0ce373066f524eab618ce931af;p=thirdparty%2Fdracut.git dracut-lib: add str_ends, to go along with str_starts --- diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index cb2e4dcba..1ecd28666 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -12,6 +12,11 @@ str_starts() { [ "${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' # # str_replace str search replacement