[X-Unix] Cron problem solved

Robert Frank robert.frank at unibas.ch
Mon Jun 27 00:49:38 PDT 2005


The $(...) actually starts a sub shell, then returns the result. In  
the below fragment, you can simply write:

for screen in mg*
do
   ...
done

provided you are in the directory with the screen shots when the  
script starts, and file globbing is not turned off. There is no need  
to run a subshell in order to get a list of files. The list is  
automatically composed by simply using 'mg*'.

And: you could of course immediately promote the files to pdf in the  
capture script:

cd /path/to/dir/with/screen/shots
now=`/bin/date "+%H%M%S"` # note the two backtics!
  /usr/sbin/screencapture mg$now
/path/to/ps2pdf mg$now            # substitute the /path/to
/bin/rm mg$now


The next step is, of course, to archive these shots from time to time  
(e.g. once a month), then to get rid of them when no longer used  
(e.g. after one year).

Robert

On 25 Jun 2005, at 6:18, x-unix- 
request at listserver.themacintoshguy.com wrote:

> At the end of the day, I use ps2pdf to convert the files to pdf, so I
> can view them as a series of screen shots in iMovie. I created the
> following script which I run to do the conversion and remove the
> original files:
>
> #!/bin/sh        #psconvert
>
> for screen in $(ls mg*)
> do
>          ps2pdf $screen
> done
> rm mg*[1-9]
> exit
>
> which leaves a series of files like:
>          mg103000.pdf
>
> So, thanks again for all of the suggestions. I hope the results will
> be useful to someone.
>

Departement Informatik   FGB   tel   +41 (0)61 267 14 66
Universität Basel                          fax. +41 (0)61 267 14 61
Robert Frank
Klingelbergstrasse 50                 Robert.Frank at unibas.ch
CH-4056 Basel
Switzerland                                   http:// 
www.informatik.unibas.ch/personen/frank_r.html




More information about the X-Unix mailing list