indeed.. 1 for the 'xyz abcd' call, and 1 for Perl running abcd.pl. So no surprise, when you don't run Perl, you don't get 1 for Perl..

You could grep -v the xyz(or rather $0) call out, if you like.. but please realize that this is not a good way of dealing with the problem... what are you going to do, if you start using emacs next month? - you'll have to rewrite all your shell scripts?..

It seems your Perl script needs to know how many instances of itself are running. This is different than knowing about any random process, if only because you have control over it.. Perhaps it can read and increment a number, saved in a file in some global location.. or just touch a new file somewhere.. or you could have a global watcher script, that registers new instances ( although that sounds a little far fetched )..

I'm just sure that there are many solutions that don't involve convoluted shell calls..


In reply to Re^2: sounds like the shell script is buggy by ivancho
in thread Reaped: by NodeReaper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.