On 12.02.2012 11:24, Robert Bonomi wrote:
> In article <10072393....@PointedEars.de>,
> Thomas 'PointedEars' Lahn <use...@PointedEars.de> wrote:
>> Janis Papanagnou wrote:
>>
>>> Am 10.02.2012 08:33, schrieb Ralph Spitzner:
>>>> Robert Bonomi wrote:
>>>> [...]
>>>>> The "classical" method uses basename(1).
>>>> [...]
>>>> Am I missing somethinge here ?
>>>
>>> Yes; reading the man page:
>>>
>>> "[...] any leading directory components removed. [...]"
>>
>> Which is not what the OP is looking for.
>
> Per the OPs _example_ he was dealing with files in the 'current directory',
> so there was no directory component to remove.
Correct. That's why basename, as used by the poster, did not work.
>
> Try 'basename foobar ar' on _your_ system, and see what happens.
That does not match what the poster tried; which was...
>>>> bash-4.1# basename 01.\ Whiteman\ macht\ den\ Reim.mp3
>>>> 01. Whiteman macht den Reim.mp3
IOW, he used basename with just one argument. (If he had read the
manpage he would have known that and also that it can be use with
another argument in case he cares, which he shouldn't, since there
are the built-in shell constructs that I suggested in my posting.)
Janis