LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 10: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, 09:46 PM   #2
bigjohn
Senior Member
 
Registered: Jun 2002
Location: UK .
Distribution: *buntu (usually Kubuntu)
Posts: 2,692
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, 08: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, 06: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, 07:03 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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



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 04:51 PM
find: missing argument to `-exec' pavodive Linux - Newbie 4 10-05-2009 02:24 PM
redhat 9.0 how to use the command 'find' with the action -exec arvin_shu Linux - Newbie 3 11-30-2005 07:09 AM
Help sought with 'find -exec' drjones69 Linux - Software 2 04-27-2005 04:02 AM
find -exec question eantoranz Linux - General 1 06-26-2004 10:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:04 AM.

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
Open Source Consulting | Domain Registration