core-lightning/tools/rel.sh
William Casarin f8fa4213f1 tools: use /usr/bin/env bash instead of /bin/bash
These commands fail on systems that do not have bash under /bin

Signed-off-by: William Casarin <jb55@jb55.com>
2018-07-24 00:25:43 +00:00

8 lines
241 B
Bash
Executable File

#!/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}"