Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIrcq-00069N-Az for pgsql-general@arkaria.postgresql.org; Tue, 02 Aug 2022 13:07:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIrcp-0002GK-45 for pgsql-general@arkaria.postgresql.org; Tue, 02 Aug 2022 13:07:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIrco-0002GB-Nf for pgsql-general@lists.postgresql.org; Tue, 02 Aug 2022 13:07:54 +0000 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oIrci-0006YS-FG for pgsql-general@lists.postgresql.org; Tue, 02 Aug 2022 13:07:54 +0000 Received: by mail-oi1-x236.google.com with SMTP id s204so16451374oif.5 for ; Tue, 02 Aug 2022 06:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=FwtAxj3ppgxYsY/B72adVx782mWhKt+GN+0J4Sp1cdY=; b=Zan2ASx2ZUzVKHMehtfEQH9AY8N4duhSmDG3vpXX38TD40egwAD3GHEP95YCrenwHE 7kVEsfi/I1Tw4eb16XfAfFPEcfL6j5d1nTKPiR1b3UnhRFhi6nLlVpPpjTPkPQyRiZGu 2h7UaZ6qowb22XQ98X+Dlv92PtaKvJv2TMZBOMot5Pf1DFzIKAE7koZICCzhUCOWUs+C kMeAWC4GPjXim5+FcH2lmK84FIrEYoO6D2N4/I6CE+/zgJJTC/Mtk7TuqngKccirD4sh leeQ4oHOGloLvKyL18slPdKliMHRAMWDFE767ASIv1ChcSzTGdDUrj0FCbGCAyqkksVo DVCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=FwtAxj3ppgxYsY/B72adVx782mWhKt+GN+0J4Sp1cdY=; b=qVGKQ4JjujNShgkPP4hcFazNtZyxoJJHG1St5qk3BEe1o/iaP1uSBdmm+X3j6i2Ocj 4xrkncUj1XKrDAwK3TpxzCfoGUInRJuubBHGMjsek1pC5AGDTEbOrKzxCNbI2RywXvwZ DuG4k3iEFjecIHwd7an4AtwEq0bLFvWjyo4n42POZHpz74Tik41nanUGo5Uo7S7TyaNK OFkcVI4nOGmMzFSwcBakfsyqR1FJ5YSKeVOD5w4iNi3wfzzVUEpnGZCVV5UYjLQ426Mw guTpDO+L8UF3g9+l4ffbNm2VTIo9Nl/ggsk1b3I1bKncgKgqiHvj4qA/G1fyzMG7DVGb ovRQ== X-Gm-Message-State: AJIora85wAUdeYSmMzPiC7SU3wwi1+4WKjqaa8LVbS0Zd/uHm7HZCzGu 96qTo6dIWp7A0pHvsAOjs5fpAck5AvE= X-Google-Smtp-Source: AGRyM1uAToif83Z6Ktjh+FJuLgfsJLuzL/XIZnmPCtzdzLgR1HguvtkNA5rTsP3+14DQJJBAZ/cF6g== X-Received: by 2002:a05:6808:d47:b0:33a:adad:f39a with SMTP id w7-20020a0568080d4700b0033aadadf39amr7832647oik.284.1659445666020; Tue, 02 Aug 2022 06:07:46 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id a15-20020aca1a0f000000b00339c8aab320sm3002677oia.3.2022.08.02.06.07.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Aug 2022 06:07:45 -0700 (PDT) Message-ID: <2bc84dca-4740-f6ba-f1a2-62751d6da75e@gmail.com> Date: Tue, 2 Aug 2022 08:07:44 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: Syntax error when combining --set and --command has me stumped Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <352ceea1-029d-726e-89b5-74be4946e67b@gmail.com> <20220729100518.6a8f819e@nautilus> From: Ron In-Reply-To: <20220729100518.6a8f819e@nautilus> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/29/22 04:05, Gianni Ceccarelli wrote: > If you can use bash, or set up some redirections from whatever you're > using to execute ``psql``, you can do:: > > $ psql somedb --set num=42 <<<'select :num' > Timing is on. > Expanded display is used automatically. > Line style is unicode. > Border style is 2. > ┌──────────┐ > │ ?column? │ > ├──────────┤ > │ 42 │ > └──────────┘ > (1 row) > > Time: 0.517 ms > > or (more classically):: > > echo 'select :num' | psql somedb --set num=42 Since my process uses the same variable in multiple bash statements, I decided to use a bash environment variable. -- Angular momentum makes the world go 'round.