home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.linux.misc      Linux-specific topics not covered by oth      135,536 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 134,683 of 135,536   
   Rich to rbowman   
   Re: Ridiculous Online Programming "Advic   
   12 Jan 26 06:02:07   
   
   From: rich@example.invalid   
      
   rbowman  wrote:   
   > On Sun, 11 Jan 2026 02:45:59 -0500, c186282 wrote:   
   >   
   >> On 1/11/26 02:31, rbowman wrote:   
   >>> On Sat, 10 Jan 2026 20:14:49 -0500, c186282 wrote:   
   >>>   
   >>>>     def AmRunning(ss) :   
   >>>>       return os.popen("ps ax").read().count(ss) # get, unwrap, count   
   >>>   
   >>> .bashrc AmRunning() {   
   >>>      ps aux | grep $1 | wc -l   
   >>> }   
   >>   
   >>    "aux" creates a much larger text.   
   >>   
   >>    And, for this purpose, no 'grep' is needed or desired.   
   >   
   > $ ps aux | wc   
   >     419    5866   71885   
   >   
   >  ps ax | wc   
   >     418    3347   55870   
   >   
   > From 'man ps'   
   >   
   >       To see every process on the system using BSD syntax:   
   >           ps ax   
   >           ps axu   
   >   
   >   
   > I suppose you think count(ss) isn't doing a sort of grep as it tests   
   > every element in the list for ss.   
      
   I also pointed out that fact out as well.  The python count(ss) is a   
   combined grep [1] and wc.  I'm slightly undecided if c186282 did not   
   realize that a grep is present, just hidden.   
      
   [1] Although it may be a less powerful grep if it only supports   
   substring match (likely) instead of regular expressions.   
      
   > I should thank you. It did inspire me to add   
   >   
   > Find() {   
   >         find . -name $1 | xargs grep $2   
   > }   
   >   
   > to my .bashrc. I use it a lot and was always going to get roundtoit.   
      
   You may want to quote the $1 expansion, or the find will complain the   
   first time you do 'Find "something with spaces"'   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca