[NCLUG] shell scripting

Eric Brunson brunson at level3.net
Thu Sep 13 11:26:09 MDT 2001


maybe something like 

find /your/dir -ctime 1 -print

will find the files you're interested in, the syntax for a for loop in
bash is in the man page and left as an exercise for the reader.

Here's a tip though:

To get the output of a command on the command line as if you typed it,
use $( command args )

i.e.:

clotho(~)$ ls -d1 t*
tangent/
template
test.py*
thehood.jpg
tiny_spark.mp3

clotho(~)$ echo $( ls -d1 t* )
tangent/ template test.py thehood.jpg tiny_spark.mp3

See also: xargs


* mike cullerton (michaelc at cullerton.com) [010913 11:10]:
> hey folks,
> 
>   hope everyone and all your loved ones are well.
> 
>   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 am using bash.
> 
> thanks,
> mike
> 
> -- mike cullerton   michaelc at cullerton.com
> 
> 
> _______________________________________________
> NCLUG mailing list
> NCLUG at nclug.org
> http://www.nclug.org/mailman/listinfo/nclug


-- 
 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