The following behavior confused me:

basename .a .a
.a

while I expected no output, since there is nothing in front of
`.a'. This is not a completely made up situation: I may do

basename /usr/lib/$A.a .a

and if $A is unset, I get the suffix `.a'.  (This is how I noticed the
problem, since I tested for the empty string as a possible output of
the above, and not for `.a') 

Is this a feature?  The behavior contradicts the info documentation:


   "If SUFFIX is specified and is identical to the end of NAME, it is
removed from NAME as well."

If I remove .a from "".a, I get "".  Or NAME is not supposed to be ""?
But I get 

A=.a echo b${A%.a}
b

I notice that Solaris's basename behaves the same as GNU's. 

Thx

Mate
-- 
---
Mate Wierdl | Dept. of Math. Sciences | University of Memphis  

Reply via email to