remove double slashes for symlink conversion from absolute to relative
done
}
+normalize_path() {
+ p=$1
+ while [[ ${p#*//*} != $p ]]; do
+ p=${p/\/\///}
+ done
+ echo $p
+}
convert_abs_rel() {
local __current __absolute __abssize __cursize __i __level __newpath
echo "."
return
fi
-
+ __current=$(normalize_path "$1")
+ __absolute=$(normalize_path "$2")
IFS="/"
- __current=($1)
- __absolute=($2)
+ __current=($__current)
+ __absolute=($__absolute)
__abssize=${#__absolute[@]}
__cursize=${#__current[@]}