Re: problem with shell script

2011-01-13 Thread perryh
David Scheidt dsche...@panix.com wrote: ps ax | grep [s]lapd | wc -l The [] creates a one-character class that doesn't match the regex. Doesn't [s]lapd need to be quoted? [] are special to (at least some) shells. ___ freebsd-questions@freebsd.org

Re: problem with shell script

2011-01-13 Thread Igor V. Ruzanov
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 13 Jan 2011, per...@pluto.rain.com wrote: |David Scheidt dsche...@panix.com wrote: | | ps ax | grep [s]lapd | wc -l | | The [] creates a one-character class that doesn't match the regex. | |Doesn't [s]lapd need to be quoted? [] are special

problem with shell script

2011-01-13 Thread four . harrisons
Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well ps ax | grep slapd | grep -v grep | wc -l 1 If I run in the following shell script : #!/bin/sh SD=0 SD=`ps -ax | grep slapd | grep -v grep |

Re: problem with shell script

2011-01-13 Thread Julien Cigar
just use: pgrep slapd On 01/12/2011 15:17, four.harris...@googlemail.com wrote: Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well ps ax | grep slapd | grep -v grep | wc -l 1 If I run in

Re: problem with shell script

2011-01-13 Thread Samuel Martín Moro
?? as already answered: ps ax | awk '/[/]slapd /{n++} END{print n}' searching '[s]lapd' will avoid grep auto-matching, but would still return commands like vim /etc/slapd.conf or ./myscript-slapd about pgrep, like the usual grep, it needs a better expression than the process name, otherwise it

Re: problem with shell script

2011-01-13 Thread Robert Bonomi
Date: Wed, 12 Jan 2011 15:01:45 +0100 From: Frank Bonnet f.bon...@esiee.fr Subject: problem with shell script Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well ps ax | grep slapd | grep -v

Re: problem with shell script

2011-01-13 Thread Devin Teske
On Thu, 2011-01-13 at 14:45 -0600, Robert Bonomi wrote: Date: Wed, 12 Jan 2011 15:01:45 +0100 From: Frank Bonnet f.bon...@esiee.fr Subject: problem with shell script Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands

problem with shell script

2011-01-12 Thread Frank Bonnet
Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well ps ax | grep slapd | grep -v grep | wc -l 1 If I run in the following shell script : #!/bin/sh SD=0 SD=`ps -ax | grep slapd | grep -v grep |

Re: problem with shell script

2011-01-12 Thread Chad Kellerman
On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet f.bon...@esiee.fr wrote: Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well ps ax | grep slapd | grep -v grep | wc -l 1 If I run in the

Re: problem with shell script

2011-01-12 Thread Samuel Martín Moro
On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman sunck...@gmail.com wrote: On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet f.bon...@esiee.fr wrote: Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs

Re: problem with shell script

2011-01-12 Thread Samuel Martín Moro
On Wed, Jan 12, 2011 at 4:34 PM, Samuel Martín Moro faus...@gmail.comwrote: On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman sunck...@gmail.comwrote: On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet f.bon...@esiee.fr wrote: Hello I'm in trouble with a simple shell script that give

Re: problem with shell script

2011-01-12 Thread David Scheidt
On Jan 12, 2011, at 10:43 AM, Samuel Martín Moro wrote: On W If I run in the following shell script : #!/bin/sh SD=0 SD=`ps -ax | grep slapd | grep -v grep | wc -l` echo $SD the result is 3 !!! ps ax | grep [/]slapd | wc -l ps ax | awk '/[/]slapd /{n++} END{print n}'

Re: problem with shell script

2011-01-12 Thread Warren Block
On Wed, 12 Jan 2011, Samuel Mart?n Moro wrote: On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman sunck...@gmail.com wrote: On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet f.bon...@esiee.fr wrote: I'm in trouble with a simple shell script that give erroneous value when running ... If I run

Re: problem with shell script

2011-01-12 Thread Chip Camden
Quoth Frank Bonnet on Wednesday, 12 January 2011: Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well ps ax | grep slapd | grep -v grep | wc -l 1 If I run in the following shell script

Re: problem with shell script

2011-01-12 Thread Ryuichiro Hara
(2011/01/13 01:00), Warren Block wrote: On Wed, 12 Jan 2011, Samuel Mart?n Moro wrote: On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman sunck...@gmail.com wrote: On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet f.bon...@esiee.fr wrote: I'm in trouble with a simple shell script that give

Re: problem with shell script

2011-01-12 Thread Ryuichiro Hara
(2011/01/12 23:01), Frank Bonnet wrote: Hello I'm in trouble with a simple shell script that give erroneous value when running ... If I run commands interactively everything runs well ps ax | grep slapd | grep -v grep | wc -l 1 If I run in the following shell script : #!/bin/sh SD=0

Re: problem with shell script

2011-01-12 Thread Jonathan McKeown
On Wednesday 12 January 2011 17:58:33 David Scheidt wrote: ps ax | grep [s]lapd | wc -l The [] creates a one-character class that doesn't match the regex. Easier to type and grep should be a bit faster. And you can save another process by using ps ax | grep -c '[s]lapd' Although as