On 9/1/07, Raj Mathur <[EMAIL PROTECTED]> wrote:
> On Saturday 01 September 2007 09:57, Jay wrote:
> > I am newbie to shell script programing. I was trying to write a
> > script which will compile all the .cpp file in a folder as mention
> > below:
> >
> > for f in *.cpp; do gc++ $f; done;
> > mv *.cpp /data/jay/success
> > mv *.out /data/jay/success
> >
> > And this is working fine, but the issue is, if any .cpp file is
> > having compilation error, my batch execution getting stuck. Can
> > anybody help me out to ignore the compilation error and jump to next
> > file compilation? And also, how to move all the error files with log
> > file to a different directory.
>
> Try something like:
>
> for i in *.cpp
> do
>   out=`basename $i .cpp`.out
>   g++ $i -o $out && ( mv $i /wherever ; mv $out /wherever )
> done > LOG 2>&1
>
> The files remaining in the current directory are the ones that didn't
> get compiled.  LOG will contain the compilation log.
>
> The snippet above may not work exactly as advertised, so be sure to test
> and fix before running on live data.
>
> Regards,
>
> -- Raju
> --
> Raj Mathur                [EMAIL PROTECTED]      http://kandalaya.org/
>  Freedom in Technology & Software || September 2007 || http://freed.in/
>        GPG: 78D4 FC67 367F 40E2 0DD5  0FEF C968 D0EF CC68 D17F
> PsyTrance & Chill: http://schizoid.in/   ||   It is the mind that moves
>

Thanks for your suggestion Raju,

It is working fine, but I want to know, how to pass ^z command to a
busy terminal. Suppose due to some compilation issue (infinite loop,
etc.) my terminal got blocked, how can I pass ^z command to a busy
terminal through shell script. Please suggest.

...Jay

_______________________________________________
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - September 28-29, 2007
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/

Reply via email to