From 95c2403395bd2c1d776ecae8c2325016814d1bb2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 20 Sep 2008 17:18:46 +0200 Subject: rtab: Fixed a bug in -l As pointed out by mxey: When a path contains the same directory name several times, -l will cut off the path after the first of those names. --- etc/functions/rtab | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'etc/functions') diff --git a/etc/functions/rtab b/etc/functions/rtab index 360e551..bb7d225 100644 --- a/etc/functions/rtab +++ b/etc/functions/rtab @@ -53,11 +53,9 @@ tree=(${(s:/:)dir}) cd / } for dir in $tree; { - if (( lastfull )) { - if [[ $dir == $tree[-1] ]] { - result+="/$tree[-1]" - break - } + if (( lastfull && $#tree == 1 )) { + result+="/$tree" + break } expn=(a b) part='' @@ -70,6 +68,7 @@ tree=(${(s:/:)dir}) done result+="/$part" cd $dir + shift tree } echo $result ) -- cgit v1.2.3