X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=lib%2Ftools.in;fp=lib%2Ftools.in;h=b180950789c60ead1def01525e69dca8c78279e2;hp=fe7d54a38de94fc8c7b44513e402e227314021d8;hb=ac915b2a77c0bcbcacc8b07042c7d3d2eeebb79a;hpb=9341c146cc103ab8a4d24fac699f1b88acd563ad diff --git a/lib/tools.in b/lib/tools.in index fe7d54a..b180950 100644 --- a/lib/tools.in +++ b/lib/tools.in @@ -89,3 +89,11 @@ function interpolate() { # Do the actual interpolation echo $path | sed "$expr" } + +# Does the $1 start with $2 ? +function starts_with() { + # Get the head of $1 as long as $2 + head=`echo $1 | head -c ${#2}` + # Is it equal to $2? + [ "$head" = "$2" ] +}