You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 lines
241 B

#!/usr/bin/env bash
from=${1}
to=${2}
common=$(printf '%s\n%s' "${from}" "${to}" | sed 'N;s/\(.*\).*\n\1.*$/\1/' | sed 's@/[^/]*$@/@')
prefix=$(printf '%s\n' "${from#$common}" | sed 's@[^/][^/]*@..@g')
printf '%s\n' "$prefix/${to#$common}"