Mailing List Archive

Support open source code!

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

Re: funny bug

On Thu, Apr 05, 2001 at 09:35:34PM +0200, Fredric Fredricson wrote:
> Viktor Pavlenko wrote:
> > 
> > I want to share with you a bug in my shell script I discovered
> > yesterday. The script was in production for quite a while...
> > 
> > In the shell script I test if a process is running:
> > 
> > if [ `ps -ef | grep [pP]rog_name | wc -l` -ne 0 ]
> > 
> Why not:
> if killall -0 prog_name ?

It won't be portable to other Unices that don't necessarily have killall
installed. On the other hand, ps(1) is just about the least portable Unix
command there is (I don't think the above example would work on BSD-ish
systems, for example), so maybe it isn't an improvement at all.

Shimpei Yamashita                     

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links