More possibilities with truncate folder marker

This commit is contained in:
Benoit Averty 2016-08-10 21:31:58 +02:00 committed by Dominik Ritter
commit 9f4772f993
2 changed files with 27 additions and 20 deletions

View file

@ -211,15 +211,16 @@ function truncatePathFromRight() {
# Search recursively in parent folders for given file.
function upsearch () {
if test -e "$1"; then
if [[ "$PWD" == "$HOME" || "$PWD" == "/" ]]; then
echo "$PWD"
elif test -e "$1"; then
pushd .. > /dev/null
upsearch "$1"
popd > /dev/null
echo "$PWD"
else
if [[ "$PWD" == "/" || "$PWD" == "$HOME" ]]; then
echo "$PWD";
else
pushd .. > /dev/null
upsearch "$1"
popd > /dev/null
fi
pushd .. > /dev/null
upsearch "$1"
popd > /dev/null
fi
}