On Jul  5, 2000, "Lars J. Aas" <[EMAIL PROTECTED]> wrote:

> +[echo $1 | sed 's%/[[^/][^/]]*$%%'])
 
This is not strictly correct.  It doesn't handle relative pathnames
nor `/'.  The patch is fine, since it just preserves current behavior,
and it makes it easier for someone to fix the existing limitations.
Needless to say, I'd appreciate some effort towards handling these
cases correctly, as well as DOSish pathnames (no need to care about
backslashes, IMO, just about colons)

Disregarding DOSish pathnames, the following sed script works for me:

'/^\/*$/!s%//*$%%;s%[^/]*$%%;/^\/*$/!s%//*$%%'

I'm not 100% sure about its portability, though.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Reply via email to