From owner-freebsd-questions@FreeBSD.ORG Wed Jan 12 15:15:49 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B3F6106566C for ; Wed, 12 Jan 2011 15:15:49 +0000 (UTC) (envelope-from sunckell@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id DBB228FC15 for ; Wed, 12 Jan 2011 15:15:48 +0000 (UTC) Received: by bwz12 with SMTP id 12so564737bwz.13 for ; Wed, 12 Jan 2011 07:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=IhtoSUe/HxbrASXo/UY90nGzI//oevQA1rIGTpx3q8c=; b=T40l7Q9tesOU7aYLWPDZKJ2SXE8rNJsZURxNZrsCZ1l0PoVAwyt92aP5cyPCUXlPpZ YPEj1wJauBBtDvKnaKKgzCUzP1+RKsDQ+doxcSvwUVk+VVMUXhwIzMEAwd6WGWxuO8Tk h6k6UXdc6OgGp49GxoF+GN09zEHmr757sMrII= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=iHt/lzifU7iaIaBX5EcjY53jWUQJvgkPMwdAGaGlHR/B/S7EgKQobOaw+9RONHTCD3 efN7HzUJ8HRkC2IEZrOsyJDvsPvQetIAnDoYyvnJIuG/5rB/EdLXQ7UCQhYTaqwheOmH IGWEEGvOgq/B+Cw9sc0O5XDs7lOBNPLKjHVSc= MIME-Version: 1.0 Received: by 10.204.58.13 with SMTP id e13mr810346bkh.148.1294843821311; Wed, 12 Jan 2011 06:50:21 -0800 (PST) Received: by 10.204.68.203 with HTTP; Wed, 12 Jan 2011 06:50:21 -0800 (PST) In-Reply-To: <4D2DB449.6070901@esiee.fr> References: <4D2DB449.6070901@esiee.fr> Date: Wed, 12 Jan 2011 09:50:21 -0500 Message-ID: From: Chad Kellerman To: Frank Bonnet Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Re: problem with shell script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2011 15:15:49 -0000 On Wed, Jan 12, 2011 at 9:01 AM, 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 > SD=`ps -ax | grep slapd | grep -v grep | wc -l` > echo $SD > > the result is 3 !!! > > > Any info welcome ! > What's the name of your script? Hope it's not slapd_check.sh that will cause and extra count in the ps, cus it will count itself. Chad > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" > -- A grasshopper walks into a bar and the bartender says "Hey, we have a drink named after you." And the grasshopper says "Really, You have a drink named Murray?"