pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wim Bertels <wim.bertels@ucll.be>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
To: mnunna@fnal.gov <mnunna@fnal.gov>
Subject: Re: Output shell variable from psql
Date: Mon, 8 Apr 2024 15:30:07 +0000
Message-ID: <2d780c962fe0bf751857c68358e1db74ddae29c3.camel@ucll.be> (raw)
In-Reply-To: <DM8PR09MB667723C1012EDD032EC1BE22B8002@DM8PR09MB6677.namprd09.prod.outlook.com>
References: <DM8PR09MB667723C1012EDD032EC1BE22B8002@DM8PR09MB6677.namprd09.prod.outlook.com>

Murthy Nunna schreef op ma 08-04-2024 om 15:17 [+0000]:
> U ontvangt niet vaak e-mail van mnunna@fnal.gov. Meer informatie over
> waarom dit belangrijk is
> 
> Hi,
>  
> Is there a way to output shell variable from psql?
>  
> export TEST_V=7
> echo Value is  ${TEST_V}
> Value is 7
>  
> psql -U postgres -p 5439
> \echo Value is  ${TEST_V}
> Value is ${TEST_V}

$ export test=E
$ psql
psql (16.2 (Debian 16.2-1.pgdg120+2))
Type "help" for help.

wim=# \! echo $test
E
wim=# 

hth,
Wim

>  
> Thanks!
>  
>  



view thread (6+ messages)  latest in thread

Message-ID: <2d780c962fe0bf751857c68358e1db74ddae29c3.camel@ucll.be>
Permalink:  ../2d780c962fe0bf751857c68358e1db74ddae29c3.camel@ucll.be/
Also on:    postgresql.org/message-id/2d780c962fe0bf751857c68358e1db74ddae29c3.camel@ucll.be

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: wim.bertels@ucll.be, mnunna@fnal.gov
  Subject: Re: Output shell variable from psql
  In-Reply-To: <2d780c962fe0bf751857c68358e1db74ddae29c3.camel@ucll.be>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox