Unix Shell - exec in ksh

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > November 2007 > exec in ksh





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author exec in ksh
Patrick

2007-11-22, 7:33 am

Hi,
my script:

while read LINE
do
echo $LINE | awk '{FS=":"} {print $1" " $2" " $3}' | read DIR FILEN
OLD
EDIR=$(eval echo $DIR)
[ ! -d $EDIR -o ! -w $EDIR ] && continue
find $EDIR -type f -name "$FILEN" -mtime +$OLD -exec ls {} \;
find $EDIR -type f -name "$FILEN" -mtime +$OLD -exec rm -f {} \;
done < $SCRIPTS_DIR/etc/mftab

if i wont to change rm -f with cp -p <source> <dest> where source is
the result of the find, how can i do?
thx
Barry Margolin

2007-11-22, 7:22 pm

In article
<f3be643c-0259-4dc3-9d2f-2b4092fdf2c0@g21g2000hsh.googlegroups.com>,
Patrick <patrick.moresi@gmail.com> wrote:

> Hi,
> my script:
>
> while read LINE
> do
> echo $LINE | awk '{FS=":"} {print $1" " $2" " $3}' | read DIR FILEN
> OLD
> EDIR=$(eval echo $DIR)
> [ ! -d $EDIR -o ! -w $EDIR ] && continue
> find $EDIR -type f -name "$FILEN" -mtime +$OLD -exec ls {} \;
> find $EDIR -type f -name "$FILEN" -mtime +$OLD -exec rm -f {} \;
> done < $SCRIPTS_DIR/etc/mftab
>
> if i wont to change rm -f with cp -p <source> <dest> where source is
> the result of the find, how can i do?
> thx


find ... -exec cp -p {} dest \;

BTW, it would be nice if the Subject actually described the post? I see
no use of exec in your script. Your question is about find.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Kenny McCormack

2007-11-22, 7:22 pm

In article <barmar-425BAA.14292622112007@comcast.dca.giganews.com>,
Barry Margolin <barmar@alum.mit.edu> wrote:
....
>find ... -exec cp -p {} dest \;
>
>BTW, it would be nice if the Subject actually described the post? I see
>no use of exec in your script. Your question is about find.


'exec' as a find option.

Patrick

2007-11-23, 7:31 am

On 22 Nov, 21:16, gaze...@xmission.xmission.com (Kenny McCormack)
wrote:
> In article <barmar-425BAA.14292622112...@comcast.dca.giganews.com>,
> Barry Margolin <bar...@alum.mit.edu> wrote:
> ...
>
>
>
> 'exec' as a find option.


Thank you to all!!
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com