[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shorthand attempt at 'basename file .ext'
From: |
Chris F.A. Johnson |
Subject: |
Re: shorthand attempt at 'basename file .ext' |
Date: |
Sat, 29 Mar 2008 16:53:59 +0000 |
User-agent: |
slrn/0.9.8.1 (Linux) |
On 2008-03-28, Eric Blake wrote:
> 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 '--'.
Right; I'll fix that. Thanks for pointing it out.
> 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.
"
2. If string is "//", it is implementation-defined whether steps 3
to 6 are skipped or processed.
"
I see no reference in the spec to "// /". Can you tell me where it
is?
--
Chris F.A. Johnson, webmaster <http://Woodbine-Gerrard.com>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
.