# 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" ]
+}
+
+# Strip the prefix $2 from $1. Assumes that $1 actually starts with $1.
+# The result is put on stdout.
+function strip_prefix() {
+ # Strip the first ${#2} (the length of $2) characters from $1.
+ # tail -c +N means start at the Nth byte, 1-based, so we add 1.
+ echo $1 | tail -c +$((${#2}+1))
+}