[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: commands within shell script



Hi,

On Tue, Mar 04, 2003 at 12:15:56PM -0800, Vineet Kumar wrote:
> * Nori Heikkinen <nori@sccs.swarthmore.edu> [20030304 12:11 PST]:
> > hey,
> > 
> > by default, a shell script just appears as the script name in a list
> > of processes (ps; top), right?  how can i make it show each command
> > called within the script as it's being executed?
> 
> It already is.  For each program called from the script, 
> the shell forks and execs a new process, which shows up in the 
> process list.  Of course, you won't see shell builtin commands 
> in the process list, just the shell name and script name.

But see this, I don't understand:

( ~ )$    
( ~ )$ echo 'sleep 10' > test.sh
( ~ )$ chmod +x test.sh
( ~ )$ ./test.sh &
[1] 9771
( ~ )$ ps
  PID TTY          TIME CMD
26101 pts/3    00:00:00 bash
 9771 pts/3    00:00:00 bash
 9772 pts/3    00:00:00 sleep
 9773 pts/3    00:00:00 ps
( ~ )$
( ~ )$
[1]+  Done                    ./test.sh
( ~ )$
     
and If I had run it in background, then on another terminal, I saw
in 'ps -A' the bash and sleep processes too.


-- 
+----------------------------------+
| Martin Kacerovsky                |
| e-mail : wizard(AT)matfyz(DOT)cz |
| home   : http://wizard.matfyz.cz |
+----------------------------------+

Attachment: pgpew_L6NWgCr.pgp
Description: PGP signature


Reply to: