public inbox for [email protected]  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <[email protected]>
To: Murthy Nunna <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Bash function from psql (v14)
Date: Sun, 10 Nov 2024 09:55:34 -0500
Message-ID: <CAKAnmmL2ib1=-x-kpqaWPL6RoLa4qbeFWAeSGEB5SZ2pyeTLPA@mail.gmail.com> (raw)
In-Reply-To: <DM8PR09MB6677887ED1DA5D9494E2055CB85E2@DM8PR09MB6677.namprd09.prod.outlook.com>
References: <DM8PR09MB6677887ED1DA5D9494E2055CB85E2@DM8PR09MB6677.namprd09.prod.outlook.com>

What problem are you trying to solve? If you tell us that, we can guide you
to some better solutions.

There are numerous issues here, but the most important are:

1) Calling a shell via \! invokes an entirely new process: there is no link
to the parent or grandparent process

2) The run-bash-function must be declared before being called, so that bash
code was never going to work anyway. In other words, this is valid:

run-bash-function() { echo "Here we are"; }

run-bash-function

This version is not:

run-bash-function

run-bash-function() { echo "Here we are"; }


Cheers,
Greg


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: <CAKAnmmL2ib1=-x-kpqaWPL6RoLa4qbeFWAeSGEB5SZ2pyeTLPA@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