[mythtv] Screenshot Shell Script...

Pascal Favre Pascal.Favre at gmx.net
Thu Aug 11 20:04:05 UTC 2005


Hello
  If you do not know the suffix then you cannot use basename.
  ksh and bash have string extension which can do the job.

  Below are expressions which will work in every shell:

  path="`expr "$i" : '\(.*\)/'`"                  # get file path (if any)
  name="`expr "//$i" : '.*/\([^/]*\)'`"           # remove path to file
  suffix="`expr "$name" : '.*\.\([^./]*\)$'`"     # extract last suffix
  name="`expr "$name" : '\(.*\)\.[^.]*$'`"        # remove last suffix

Pascal

----- Original Message ----- 
From: "Daniel Staaf" <dst at bostream.nu>
To: "Development of mythtv" <mythtv-dev at mythtv.org>
Sent: Thursday, August 11, 2005 9:31 PM
Subject: Re: [mythtv] Screenshot Shell Script...


> Jochen Kühner skrev:
>> I've restarted my shellscript to use sh instead of php.
>>
>> but now i need help,
>>
>> first, the option to extrat the filename of a path and a extsion. (like /aa/bb/cc/dd.eee then i need dd)
>
> basename /aa/bb/cc/dd.eee .eee
>
> / Daniel
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
> 



More information about the mythtv-dev mailing list