#!/bin/sh # usage: unprefix prefix path # # Print path, but if it starts with prefix, first remove the prefix. echo "$2" \ | sed -e 's%^'"`echo $1|sed 's%//*$%%'`"'%%' -e tn -e q -e ':n' -e 's%^//*%%'