Commit 0a48bcb6 authored by Valentin Samir's avatar Valentin Samir
Browse files

[.bashrc] Stop find_up if directory does not exist

parent f1116cc0
...@@ -45,12 +45,17 @@ fi ...@@ -45,12 +45,17 @@ fi
# des infos quand on est dans un dépôt versionné # des infos quand on est dans un dépôt versionné
find_up () { find_up () {
local path normalized_path normalized_ret
path="$1" path="$1"
shift 1 shift 1
while [[ "`readlink -f -- \"$path\"`" != "/" ]]; normalized_path=`readlink -f -- "$path"`
normalized_ret=$?
while [[ "$normalized_path" != "/" ]] && [ $normalized_ret -eq 0 ];
do do
find "$path" -maxdepth 1 -mindepth 1 "$@" find "$path" -maxdepth 1 -mindepth 1 "$@"
path=${path}/.. path=${path}/..
normalized_path=`readlink -f -- "$path"`
normalized_ret=$?
done done
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment