How can I execute own ksh function in find -exec


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can I execute own ksh function in find -exec
# 8  
Old 04-02-2007
Quote:
Originally Posted by piooooter
But, as I stated in the first post, the above command doesn't work!
Make it a separate script, not a function.
# 9  
Old 04-02-2007
Quote:
Originally Posted by piooooter
Thank you for reply.

I know that I can place that function in a separate file. On that way it has been working for a long timeSmilie but I was asked to place everything in one shell script.

Pit
As I stated, I was asked to place everything in one file.
# 10  
Old 04-03-2007
# 11  
Old 04-03-2007
Try...
Code:
find / -name "*.err" -mtime -8 -print | while read F; do send_notification $F; done

# 12  
Old 04-03-2007
Quote:
Originally Posted by piooooter
As I stated, I was asked to place everything in one file.
Sorry, I didn't mean to post that as it was incomplete but got distracted. I mean to post this:

Make it a separate script, not a function.

Use your single file to create the second script, and delete it when finished. All the code will be in one file, but you will generate the second one at runtime every time the script is run.

If doing this make sure you have a trap handler and cleanup function ( in case someone does a ^C )
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find: missing argument to `-exec' while redirecting using find in perl

Hi Friends, Please help me to sort out this problem, I am running this in centos o/s and whenever I run this script I am getting "find: missing argument to `-exec' " but when I run the same code in the command line I didn't find any problem. I am using perl script to run this ... (2 Replies)
Discussion started by: ramkumarselvam
2 Replies

2. Shell Programming and Scripting

exit status from ksh script exec from java using runtime

how do i get the exit status from a ksh or perl script executed in a java program using Runtime? (1 Reply)
Discussion started by: twk
1 Replies

3. Shell Programming and Scripting

-exec cmd in ksh script

Hi, I discovered the following single-line script works very well to cp a large number of files from a source directory to a destination directory while avoiding the "argument list too large" error: # cpmany - copy large number of files # Takes two parameters - source dir, destination dir... (14 Replies)
Discussion started by: Tanuka
14 Replies

4. Shell Programming and Scripting

understand the function to execute

Gurus, Can you please tell me why this script is executing but i am getting no result...also can you tell me what is this gettime() doing? in a script i wrote this hour.SH -------------------------- gettime() { date '+%H' | { read hour TIME=${hour} } } : ----------------------... (2 Replies)
Discussion started by: RubinPat
2 Replies

5. Shell Programming and Scripting

How to execute piped command using exec or system

Hi All, I want to execute a piped command like 'ls /opt | grep xml' using array as parameters list. How can I do that? (2 Replies)
Discussion started by: bharadiaam
2 Replies

6. UNIX for Dummies Questions & Answers

Execute "find . -exec grep" in desending Order

Hi Xperts, I've one query for you. Please help me solving this. Below command is taking long time to fetch names of the files which contain string "475193976" because folder contains millions of files. I agree that this is what this function suppose to do. Correct.. But can it be possible... (6 Replies)
Discussion started by: gav_dhiman
6 Replies

7. Programming

Runtime.getSystem.exec() function waits for child

Runtime.getSystem.exec() waits for child process to complete .. I do not want to wait for the child process to complete ..what is the option which has to be used ? (2 Replies)
Discussion started by: shafi2all
2 Replies

8. UNIX for Advanced & Expert Users

exec to call specific function in C prog

I would like to call a particular function in a C program using execl(). Is this possible using execl or anyother function ? Thanks (2 Replies)
Discussion started by: vpraveen84
2 Replies

9. Programming

alternatives of exec() system function

Hi , Can anybody name any System Function in C/C++ for Sun-Solaris (unix) platform which can serve the alternative of execl() system function. Actually I am calling a fork-execl() pair and then making an interprocess communication between these two(parent-child process). But the problem is... (3 Replies)
Discussion started by: Raj Kumar Arora
3 Replies

10. Programming

How to periodically execute a function in C ??

Hi, I am looking for a C library feature, to which I can say execute a function every 10 seconds. for Eg #include <timer_lib.h> fun1(){ printf("I am still cool "); } int main(){ run(10,&fun1); // Should register & execute the function fun1 every 10 seconds return 0x0; }... (24 Replies)
Discussion started by: RipClaw
24 Replies
Login or Register to Ask a Question