public inbox for [email protected]  
help / color / mirror / Atom feed
From: Vijaykumar Jain <[email protected]>
To: Murthy Nunna <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Bash function from psql (v14)
Date: Sat, 9 Nov 2024 23:52:04 +0530
Message-ID: <CAM+6J97=EqdFSH+Shs_GE4WSgVmHRAppWZAM4XYH7L73xOuoLQ@mail.gmail.com> (raw)
In-Reply-To: <DM8PR09MB6677887ED1DA5D9494E2055CB85E2@DM8PR09MB6677.namprd09.prod.outlook.com>
References: <DM8PR09MB6677887ED1DA5D9494E2055CB85E2@DM8PR09MB6677.namprd09.prod.outlook.com>

On Sat, 9 Nov 2024 at 23:11, Murthy Nunna <[email protected]> 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@ubuntu:/tmp$ echo 'whoami' >> myscript.sh
postgres@ubuntu:/tmp$ chmod a+x myscript.sh
postgres@ubuntu:/tmp$ psql <<EOS
\! bash /tmp/myscript.sh
EOS

postgres

*/



-- 
Thanks,
Vijay

Open to work
Resume - Vijaykumar Jain






view thread (5+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Bash function from psql (v14)
  In-Reply-To: <CAM+6J97=EqdFSH+Shs_GE4WSgVmHRAppWZAM4XYH7L73xOuoLQ@mail.gmail.com>

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

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