Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 5E8471337B69 for ; Thu, 27 Jan 2011 06:20:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 01990-02 for ; Thu, 27 Jan 2011 10:20:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtpcorp.com (smtpcorp.com [174.143.60.32]) by mail.postgresql.org (Postfix) with ESMTP id 4358E1337B96 for ; Thu, 27 Jan 2011 06:20:30 -0400 (AST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=main; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:Message-ID:Date:Subject:From:To; bh=+7VmnwAbySltlWF3TIEPT01G5BtyxBQTfSamv3nNyZU=; b=fheut8E4JRlTDeEis3ZiRhsynAquTFpeNjr6EYuaIoymPPzLdHYoGpaeIclkL+9RgR7X2JM5fxHMss2upHEUlTdBXJmGYkiHYRArz/bD3MIoCQ10+vurNmM+q/u8cKl3; Received: from ip-118-90-131-192.xdsl.xnet.co.nz ([118.90.131.192] helo=gonzo) by smtpcorp.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.70) id 1PiOxs-0000dD-0N; mid 144 for pgsql-sql@postgresql.org; Thu, 27 Jan 2011 10:20:32 +0000 Received: from news by gonzo with local (Exim 4.72) (envelope-from ) id 1PiOxX-0003Fu-L1 for pgsql-sql@postgresql.org; Thu, 27 Jan 2011 23:20:11 +1300 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: Compare the resulta of a count sql into bash Date: 27 Jan 2011 10:20:06 GMT Organization: Dis (not Dat) Organisation Lines: 29 Message-ID: References: NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reversiblemaps.ath.cx 1296123606 12516 127.0.0.1 (27 Jan 2011 10:20:06 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) X-Smtpcorp-Track: 21476874.1.49186963 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201101/100 X-Sequence-Number: 35047 On 2011-01-26, manuel antonio ochoa wrote: > --0015174be152ceb275049ac2dc95 > Content-Type: text/plain; charset=ISO-8859-1 > > Hello, > I have the next : > > COUNTONE=`/var/lib/pgsql/bin/./psql -U 'Thor' -d princlocal -p 5432 -h > 192.170.1.82 -c "select count(*) from monterrey.${NOMBRETB}"` > COUNTTWO=`/var/lib/pgsql/bin/./psql -U 'Thor' -dprinclocal -p 5432 -h > 192.170.1.82 -c "select count(*) from monterrey.$nombre where recibo > between '$FI' and '$FF'" > > I want to compare the result countone with countwo how does it works ? you need -t COUNTONE=`/var/lib/pgsql/bin/./psql -t -U 'Thor' -d princlocal -p 5432 -h 192.170.1.82 -c "select count(*) from monterrey.${NOMBRETB}"` COUNTTWO=`/var/lib/pgsql/bin/./psql -t -U 'Thor' -d princlocal -p 5432 -h 192.170.1.82 -c "select count(*) from monterrey.$nombre where recibo between '$FI' and '$FF'"` or like this: CONN="user=Thor database=princlocal port=5432 host=192.170.1.82" PSQL=/var/lib/pgsql/bin/psql COUNTONE=`$PSQL "$CONN" -t -c "select count(*) from monterrey.${NOMBRETB}"` COUNTTWO=`$PSQL "$CONN" -t -c "select count(*) from monterrey.$nombre where recibo between '$FI' and '$FF'"` -- ⚂⚃ 100% natural