aboutsummaryrefslogtreecommitdiff
path: root/functions/utilities.zsh
diff options
context:
space:
mode:
authorBenoit Averty <benoit.averty@gmail.com>2016-08-10 22:31:58 +0300
committerDominik Ritter <dritter03@googlemail.com>2017-02-01 01:49:46 +0300
commit9f4772f9930c7d56ab04df900ac94456e5a08a22 (patch)
treee1610866495a79d1ec3df311a1cbe3f9b5fe4a24 /functions/utilities.zsh
parent5cc2d51b5829d0ae2eefaa115892da71f6a14d79 (diff)
More possibilities with truncate folder marker
Diffstat (limited to 'functions/utilities.zsh')
-rw-r--r--functions/utilities.zsh17
1 files changed, 9 insertions, 8 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh
index 8263ce10..22b53c6a 100644
--- a/functions/utilities.zsh
+++ b/functions/utilities.zsh
@@ -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
}