LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-26-2003, 11:34 AM   #1
cricbk
LQ Newbie
 
Registered: Dec 2003
Location: indiana
Posts: 2

Rep: Reputation: 0
find -exec


How can I get the commmand

'find . -iname "*.c" -exec gcc -c {};'

to quit when gcc returns an error condition???
 
Old 12-26-2003, 10:46 PM   #2
bigjohn
Senior Member
 
Registered: Jun 2002
Location: UK .
Distribution: *buntu (usually Kubuntu)
Posts: 2,682
Blog Entries: 9

Rep: Reputation: 45
Have you tried control Z (at the same time), as that stop's most things in CLI

regards

John
 
Old 12-27-2003, 09:29 AM   #3
cricbk
LQ Newbie
 
Registered: Dec 2003
Location: indiana
Posts: 2

Original Poster
Rep: Reputation: 0
Question

I'm not sure what you mean by 'control Z at the same time'.
My ultimate goal is to put this command in a script file and
when the '-exec gcc {}' returns an error I want the script to stop, not continue on to the next file that is found.

Thanks for the reply.
Rick
 
Old 01-05-2004, 07:40 PM   #4
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Quote:
Originally posted by cricbk
My ultimate goal is to put this command in a script file and
when the '-exec gcc {}' returns an error I want the script to stop, not continue on to the next file that is found.
Can you use "make" in your script?

Peace...
 
Old 01-05-2004, 08:03 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally posted by cricbk
My ultimate goal is to put this command in a script file and
when the '-exec gcc {}' returns an error I want the script to stop,
not continue on to the next file that is found.
That's not possible, find doesn't accept the result
from exec as a control mechanism. You may have
to go another way, like bash or perl scripting.


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I execute two commands on exec of a find? eantoranz Programming 3 08-03-2010 05:51 PM
find: missing argument to `-exec' pavodive Linux - Newbie 4 10-05-2009 03:24 PM
redhat 9.0 how to use the command 'find' with the action -exec arvin_shu Linux - Newbie 3 11-30-2005 08:09 AM
Help sought with 'find -exec' drjones69 Linux - Software 2 04-27-2005 05:02 AM
find -exec question eantoranz Linux - General 1 06-26-2004 11:57 AM


All times are GMT -5. The time now is 08:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration