[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] bash problem num_of_me



"Martin Møller Pedersen" <sslug@sslug> writes:

> #!/bin/bash
>
> num_of_me=`ps -ef| grep check.sh | grep -v grep|wc -l`
> if [ $num_of_me -gt 1 ] ; then
>  echo  \$num_of_me=$num_of_me
>  echo check.sh  already running
>  exit
> fi

Ehmmm, jeg får både 2 og 3 som resultat med en overvægt af 2-tal.

Jeg kan forklare at man får 2 processer da `...` starter en subshell,
men jeg kan ikke lige se hvor den tredje shell kommer ind i
billedet. Hvis jeg også lige sætter en tee ind kan jeg se at det er
følgende der tælles linjer i:

makholm   8851  8592  0 10:52 pts/4    00:00:00 /bin/bash ./foo.sh
makholm   8852  8851  0 10:52 pts/4    00:00:00 /bin/bash ./foo.sh
makholm   8855  8852  0 10:52 pts/4    00:00:00 /bin/bash ./foo.sh

Det vil sige at der er tale om at bash spawner en bash der spawner en
bash.

//Makholm 


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2007-04-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *