Chris F.A. Johnson <cfajohnson <at> gmail.com> writes:
>
> You can find a shell function to replace the external basename
> command at: <http://cfaj.freeshell.org/shell/scripts/basename-sh>.
Except that your example is not POSIX-compliant. POSIX requires
'basename -- -a' to print '-a', not '--'.
Also, on platforms where // is special (such as cygwin), 'basename //'
and 'basename // /' should print '//', not '/', to match the behavior of the
basename program on those platforms.
--
Eric Blake