bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: basename sucks


From: Alfred M. Szmidt
Subject: Re: basename sucks
Date: Thu, 1 Feb 2007 22:47:42 +0100 (CET)

   > Furthermore, with a --suffix option, we could also allow multiple
   > command line arguments, another usage case that might prove
   > useful:
   > 
   > $ basename --suffix=.h foo.h bar.h

   It's always fun until somebody puts out an eye by having a file named
   "--suffix=.h".

Handle it the same way everything handles it: basename -- --suffix=.h

   Regarding the original query, why not just use awk?

You have touched a nerve...  :-) From the top of my head:

cat -- sed ':'
tac -- sed '1!G;h;$!d'
grep -- sed 'PATTERN/!d'
head -- sed '10q'
tail -- sed -e ':a' -e '$q;N;11,$D;ba'
dirname -- sed 's;[^/]*$;;'
basename -- sed 's;.*/;;'
cp OLD NEW -- sed 'w NEW' OLD

One can always just use something else, but most often the something
else is painful. 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]