[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: condition to execute

From: Greg Wooledge
Subject: Re: condition to execute
Date: Tue, 6 Jul 2021 18:54:24 -0400

On Tue, Jul 06, 2021 at 11:41:29PM +0200, wrote:
> In elisp, I can return an object from a function using the last command in 
> the function.
> Does this not apply to bash functions as well?

It does not.

The quest to make bash (or sh) functions return values to their caller
is the holy grail of shell scripting.  Like the holy grail, it does not
actually exist, and so the quest can never be fulfilled.  But the
tricks and techniques that people try in pursuit of this goal vary from
horrific to marginally useful.

My purpose here is to stop people from using the horrific ones.

You've already been linked to <>
and it's worth repeating.  The first page of
<> has some more commentary
about this topic.

Neither of these web pages is an exhaustive tome of all the possible ways
to exfiltrate information from inside of a function to the outside world.
There are certainly other ways, and maybe some day, someone will refine
some of them to the point where they're worth publishing.

Until then, recognize bash's limitations, and try to respect the fact
that those of us who have been working within those limitations for
decades have acquired some knowledge of what works, and what doesn't.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]