]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-lib: add str_ends, to go along with str_starts
authorWill Woods <wwoods@redhat.com>
Thu, 5 Apr 2012 17:01:35 +0000 (13:01 -0400)
committerHarald Hoyer <harald@redhat.com>
Mon, 16 Apr 2012 09:53:04 +0000 (11:53 +0200)
modules.d/99base/dracut-lib.sh

index cb2e4dcbaf4a0811901175e8008bd68ec8753901..1ecd28666678d00d43d075680b1a79ef5ddf8d97 100755 (executable)
@@ -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