localpath

This commit is contained in:
Thomas Levine 2016-04-10 21:27:04 +00:00
parent 3761493c7c
commit 2bd752012c
1 changed files with 8 additions and 11 deletions

19
urchin
View File

@ -249,14 +249,15 @@ localpath() {
child="$(fullpath "${2}" | sed 's/\/*$//')"
if test "${parent}" = "${child}"; then
echo .
# Same file
return 1
elif contains "${child}" "^${parent}";
# Child is really a child.
echo "${child##"${parent}/"}"
return 0
else
rel="${child##"${parent}/"}"
if test "${rel}" = "${parent}"; then
return 1
else
echo "${rel}"
fi
# Child is not really a child.
return 2
fi
}
@ -275,10 +276,6 @@ is_set() {
set | grep "^${1}=" > /dev/null
}
remove_trailing_slash() {
echo "$1" | sed s/\\/$//
}
# File where a test's stdout and stderr is saved
stdout_file() {
tmp_dir="${1}"