--- libs/path-manipulation.bash.in 2009-06-06 10:11:04.000000000 -0400 +++ libs/path-manipulation.bash.in 2009-08-07 09:28:59.000000000 -0400 @@ -14,9 +14,15 @@ # You should have received a copy of the GNU General Public License along with # eselect. If not, see . -# basename wrapper +# basename function basename() { - echo "${1##*/}" + pstr=${1} + + while [[ ${pstr:$(( ${#pstr} - 1 ))} == '/' ]]; do + pstr=${pstr%/} + done + + echo "${pstr##*/}" } # dirname wrapper