Hi!

On Fre, 2011-02-04 at 15:42 +0100, Harald Becker wrote:
[...] 
> > ... or you start it simply with
> > system("/PATH/TO/YOUR/SCRIPT; /PATH/TO/YOUR/APP");
> >
> > Perhaps you want to use "&&" instead of ";".
> 
> That is indeed an idea, but nut fully correct ...
> 
> ... at first the script has to be executable this way

Since the OP spoke of a "script file to be run", that should be doable.
Alternatively
system("sh /PATH/TO/YOUR/SCRIPT; /PATH/TO/YOUR/APP");
can always be done.

> ... and this way any environment settings from that script get lost
> before the application is started (which usally isn't the expected behavior)

If I "run" a script (as in "run a program"), this is precisely the
expected behaviour. 

> ... that one should do a better job:

That depends on the intentions and expectations of the OP.
If one wants to change process-local stuff (e.g. limits, environment
variables) than sourcing is the way to go.

> system( ". /PATH/TO/YOUR/SCRIPT && /PATH/TO/YOUR/APP" );
> 
> [Note the dot in front of the script name that runs the script in the
> same shell - see shell built-in "source" or "."]

That is called "sourcing" the script - and *not* "running" as in "to run
a program".
Basically it reads the file, interprets it as a script (for the current
shell) and executes the statements within the very same process (risking
to terminate it ...).
"Running the script" implicates a new process which executes it.

Bernd
-- 
Bernd Petrovitsch                  Email : [email protected]
                     LUGA : http://www.luga.at

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to