Afficher un message
Vieux 28/05/2007, 14h07   #4
Janis Papanagnou
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using basename to strip suffix

Dave Kelly wrote:
> Janis Papanagnou wrote:
>
>> CAPTION=$( basename "$filename" .jpg )
>>
>> or using shell builtins instead of costly external processes...
>>
>> CAPTION=${filename%.jpg}
>>
>>
>> Janis

>
>
> Worked like a charm. Thanks.
> Where would I go to read/learn about some of this stuff. A google search
> did not turn up any interesting leads.
> Is there a better place than 'info coreutilities'? Does this cover
> builtins?


The builtins depend on the used shell, for Kornshell for example you can
find the information in the manpage online
http://www.cs.princeton.edu/~jlk/kor...doc/man93.html
or for bash with man bash. Though careful about portability; even most
modern shells have a large common subset you may occasionally want
to restrict to the POSIX subset. (The above ${...%...} is POSIX.) Surely
the man pages are a good source to get an overview of the shell features.

Janis

>
> Thanks again.
> Dave
>
>

  Réponse avec citation
 
Page generated in 0,05290 seconds with 9 queries