[Top][All Lists]

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

Re: condition to execute

From: Lawrence Velázquez
Subject: Re: condition to execute
Date: Tue, 06 Jul 2021 18:00:23 -0400
User-agent: Cyrus-JMAP/3.5.0-alpha0-531-g1160beca77-fm-20210705.001-g1160beca

On Tue, Jul 6, 2021, at 5:41 PM, wrote:
> In elisp, I can return an object from a function using the last command 
> in the function.

Analogously, the exit status of a shell function or script is that
of the last command it executes (setting aside 'return' and 'exit'
and such).

> Does this not apply to bash functions as well?  Should all bash functions only
> return a proper exit status and nothing else?

Shell functions CANNOT return anything other than exit statuses.
That is how they work.

    $ f() { return hi; }; f
    bash: return: hi: numeric argument required

They must use other means to convey arbitrary data.  (Do not
misinterpret that error message to mean that returning numeric
results is acceptable.  It is not.)


reply via email to

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