If you do; $ exec ./foo.sh
You will simply see the following line; [Process completed] and the control does not return to the current shell. On Sat, Apr 16, 2011 at 10:21 AM, Sanjiva Weerawarana <[email protected]>wrote: > No saying "sh -c .." means you're creating a new shell and then exec'ng in > there. In that case you might as well just say "java .." (without the exec > at all). > > Doesn't having "exec java" at the end give the return code of the java > command to the calling shell? That's what's spsed to happen. > > Sanjiva. > > > On Sat, Apr 16, 2011 at 9:53 AM, Afkham Azeez <[email protected]> wrote: > >> Thanks! >> >> sh -c "exec java ..." >> worked! >> >> Earlier the script only had "exec java ..." >> >> >> On Sat, Apr 16, 2011 at 7:15 AM, Sanjiva Weerawarana <[email protected]>wrote: >> >>> Its good to use exec so that the parent shell process doesn't hang >>> around. That's common practice for shell scripts which set up a bunch of >>> stuff and run something else right at the end. >>> >>> But that should not be a problem as the process exit status should be >>> that of the exec'ed command IIRC (new command is run in the same process). >>> >>> Here's a small test: >>> >>> $ cat /tmp/foo.sh >>> #!/bin/sh >>> >>> exit 79 >>> $ sh -c "exec /tmp/foo.sh" >>> $ echo $? >>> 79 >>> >>> Sanjiva. >>> >>> On Sat, Apr 16, 2011 at 4:13 AM, Afkham Azeez <[email protected]> wrote: >>> >>>> Instead of simply doing; "java ..." we do "exec java ...". Why have we >>>> used exec here? I'm trying to solve the restart issue using exit codes, and >>>> when exec is used, the process exit code cannot be captured. >>>> >>>> -- >>>> *Afkham Azeez* >>>> Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com >>>> , >>>> * >>>> * >>>> *Member; Apache Software Foundation; >>>> **http://www.apache.org/*<http://www.apache.org/> >>>> * >>>> email: **[email protected]* <[email protected]>* cell: +94 77 3320919 >>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>* >>>> twitter: >>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> >>>> * >>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez* >>>> * >>>> * >>>> *Lean . Enterprise . Middleware* >>>> >>>> >>>> _______________________________________________ >>>> Carbon-dev mailing list >>>> [email protected] >>>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev >>>> >>>> >>> >>> >>> -- >>> Sanjiva Weerawarana, Ph.D. >>> Founder, Chairman & CEO; WSO2, Inc.; http://wso2.com/ >>> email: [email protected]; phone: +94 11 763 9614; cell: +94 77 787 6880 | >>> +1 650 265 8311 >>> blog: http://sanjiva.weerawarana.org/ >>> >>> Lean . Enterprise . Middleware >>> >> >> >> >> -- >> *Afkham Azeez* >> Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com, >> * >> * >> *Member; Apache Software Foundation; >> **http://www.apache.org/*<http://www.apache.org/> >> * >> email: **[email protected]* <[email protected]>* cell: +94 77 3320919 >> blog: **http://blog.afkham.org* <http://blog.afkham.org>* >> twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> >> * >> linked-in: **http://lk.linkedin.com/in/afkhamazeez* >> * >> * >> *Lean . Enterprise . Middleware* >> >> > > > -- > Sanjiva Weerawarana, Ph.D. > Founder, Chairman & CEO; WSO2, Inc.; http://wso2.com/ > email: [email protected]; phone: +94 11 763 9614; cell: +94 77 787 6880 | +1 > 650 265 8311 > blog: http://sanjiva.weerawarana.org/ > > Lean . Enterprise . Middleware > -- *Afkham Azeez* Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com, * * *Member; Apache Software Foundation; **http://www.apache.org/*<http://www.apache.org/> * email: **[email protected]* <[email protected]>* cell: +94 77 3320919 blog: **http://blog.afkham.org* <http://blog.afkham.org>* twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> * linked-in: **http://lk.linkedin.com/in/afkhamazeez* * * *Lean . Enterprise . Middleware*
_______________________________________________ Carbon-dev mailing list [email protected] http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
