Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Searching for the whole bash lines of a running process

0 views
Skip to first unread message

paol...@supereva.it

unread,
May 9, 2008, 3:57:47 AM5/9/08
to
Hello.
I try to make the example in Solaris.

bash>(while:;do builtins1 ; sleep 777;builtins2;done) &
***
2 questions:

i) builtins1,builtins2 are really fast in execution.Using ps you can
find always ONLY the sleep.
With ptree you can see only the originary bash from wich sleep was
launched.
Is there any way to make a complete reconstruction of the line
launched from the shell?
(ptools,truss,direct access to /proc filesystem)

ii)any way to change anything during sleep so that,after sleep will be
launched a new different builtins3?

thanks

Stephane CHAZELAS

unread,
May 9, 2008, 6:01:58 AM5/9/08
to
2008-05-9, 00:57(-07), paol...@supereva.it:

> Hello.
> I try to make the example in Solaris.
>
> bash>(while:;do builtins1 ; sleep 777;builtins2;done) &
> ***
> 2 questions:
>
> i) builtins1,builtins2 are really fast in execution.Using ps you can
> find always ONLY the sleep.
> With ptree you can see only the originary bash from wich sleep was
> launched.
> Is there any way to make a complete reconstruction of the line
> launched from the shell?
> (ptools,truss,direct access to /proc filesystem)

No, ps shows processes and the arguments that were passed to
their (or their parent's if they didn't do any) last call to
execve().

That command line is only information internal to the shell. So
unless you've taken dispositions beforhand so that the shell
makes that information available in some way (for instance by
using set -x or some trick with the ERR trap), you can't
generally access it. The best you can do is use a debugger to
attach to the running process and peek some information from
there.

> ii)any way to change anything during sleep so that,after sleep will be
> launched a new different builtins3?

[...]

Same thing, either you've taken your dispositions beforehand or
you'll have to use a debugger and hope you can alter the shell's
memory.

--
Stéphane

0 new messages