Two Kornshell functions

I'm new to Unix Kornshell.  So, if these two functions I've created 
aren't "best practice" let me know.  

I find them useful.  The first deletes files created today - the second
finds/displays files created today.

Example use:
  How...

function dtoday
{
 mon=`date|cut -d" " -f2`
 dd=`date|cut -d" " -f3`
 ls -l ../*/*.*|grep "$mon $dd"|cut -c55-140>dtoday.txt
 grep -v "today" dtoday.txt>dtoday.2.txt
 mv -f dtoday.2.txt dtoday.txt
 grep -v "my" dtoday.txt>dtoday.2.txt
 mv -f dtoday.2.txt dtoday.txt
 grep -v "zArchive" dtoday.txt>dtoday.2.txt
 mv -f dtoday.2.txt dtoday.txt
 grep -v ".ksh" dtoday.txt>dtoday.2.txt
 mv -f dtoday.2.txt dtoday.txt
 file="dtoday.txt"
 # while loop
 while read line
 do
 echo "rm -f $line"
 rm -f $line
 done <"$file"
 rm -f dtoday.txt
}
function ftoday
{
mon=`date|cut -d" " -f2`
dd=`date|cut -d" " -f3`
ls -l ../*/*.*|grep "$mon $dd"
}

No comments:

Favorite Tweets