Eric Blake <[EMAIL PROTECTED]> writes: > Since AS_BASENAME is undocumented, and since it is most useful in variable > assignments, perhaps it is time to redefine it as follows (untested) > > # AS_BASENAME(var, name, [ext]) > # ----------------------------- > # Compute the basename of NAME, with trailing EXT removed, and assign > # the result to the shell variable VAR.
I like this idea. It's been on my mental to-do list for quite some time, and it's an obvious improvement. We can't simply use "${1##*/}", though, as that mishandles the basenames of strings like "a/b/" and "///".