Hi !

As here are many shell script experts a not so Busybox related
question, except I'm using Busybox ash and want to use only builtin
applets:

I need to change behavior of shell script(s) if they get invoked from a
main shell, that is a shell (interactive or not) which is a direct
child of process #1 (init). How to determine if script has been invoked
in this environment? What is the best/easiest solution for this?

An example to clarify my needs:

I have a shell invoked from init:

$ echo "pids=$$,$PPID"
pids=156,1

And a multi function script command invoked by root in several
situations:

File /root/bin/doit:

#!/bin/busybox sh
echo "script pids=$$,$PPID"
exit 0

$ doit
script pids=1007,156

How does this doit script know if it is invoked from a top level shell
in the shown sense or from any other shell (not direct child of init
process)?

Thx ahead for help and suggestions.

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

Reply via email to