[NCLUG] shell scripting

Eric Brunson brunson at level3.net
Thu Sep 13 11:27:52 MDT 2001


* Michael Dwyer (mdwyer at sixthdimension.com) [010913 11:25]:
> >   i have what i believe is a simple shell scripting question. i have a
> > number of files in a directory. some of them have been modified today.
> i
> > want to copy the files that have been modified today to another
> directory.
> >
> > something like
> >
> >  for ($i in <modified today>) cp $i /some/directory
> 
> I think find(1) is what you are looking for.  I'm not all that
> familiar with find, but the man page is pretty good.  You'll
> probably want something like this:
> 
> cp ` find -moddate TODAY ` /some/directory
>    ^----  Backticks  ----^
> 

Backticks have been deprecated in all but the oldest of bourne shell
derivatives for years.  Try to start using the $( ) construct.  They
nest, are far more readable and are part of the POSIX spec.


-- 
 Eric Brunson   brunson at level3.net   page-eric at level3.net  
tcA thgirypoC muinelliM latigiD eht detaloiv tsuj evah uoY



More information about the NCLUG mailing list