Hi Jorge

Am 02.11.2014 um 02:48 schrieb cpu memhd:
> What I use to get rid of redundant slashes is: sed 's#//*#/#g'
> Currently:
> 
> expandpath2 /somedir/eh///he/ = /somedir/eh///he
> 

I compared your rewritten expandpath with my latest version

expandpath2 () {
        case $1 in
                /*)     echo $1 | sed 's!//*!/!g; s!/*$!!' ;;
                *)      echo `pwd`/`echo $1 | sed 's!//*!/!g;
s!^\./*!!g'` | sed 's!/*$!!' ;;
        esac
}

running expandpath on ./foo////bar///baz////
expandpath = /tmp/./foo/bar/baz

running expandpath2 on ./foo////bar///baz////
expandpath2 = /tmp/foo/bar/baz
hit any key to continue...

cheers

Erich



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

------------------------------------------------------------------------------
_______________________________________________
leaf-devel mailing list
leaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to