Re: Bash function from psql (v14)

From: Vijaykumar Jain <vijaykumarjain(dot)github(at)gmail(dot)com>
To: Murthy Nunna <mnunna(at)fnal(dot)gov>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Bash function from psql (v14)
Date: 2024-11-09 18:22:04
Message-ID: CAM+6J97=EqdFSH+Shs_GE4WSgVmHRAppWZAM4XYH7L73xOuoLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 9 Nov 2024 at 23:11, Murthy Nunna <mnunna(at)fnal(dot)gov> wrote:

> I am trying to code bash function and call it from psql. But it is failing. How can I get this to work. Creating a separate script instead of a function works, but I do not want to do that. I have too many variables to be passed back and forth. Any ideas?

> Run the above script:
>
> ./test-bash-function.sh
>
> sh: line 1: run-bash-function: command not found
>
> in bash function
>
>

/*

postgres(at)ubuntu:/tmp$ echo 'whoami' >> myscript.sh
postgres(at)ubuntu:/tmp$ chmod a+x myscript.sh
postgres(at)ubuntu:/tmp$ psql <<EOS
\! bash /tmp/myscript.sh
EOS

postgres

*/

--
Thanks,
Vijay

Open to work
Resume - Vijaykumar Jain

In response to

Browse pgsql-general by date

  From Date Subject
Next Message user 2024-11-10 13:18:16 Fwd: Fwd: Postgres attach partition: AccessExclusive lock set on different tables depending on how attaching is performed
Previous Message Efrain J. Berdecia 2024-11-09 18:02:03 Re: Bash function from psql (v14)