From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Bug or not a bug? dot expansion in ob-shell Date: Wed, 19 Feb 2020 12:38:44 +0100 Message-ID: <87r1yq4xiz.fsf@gnu.org> References: <87eeur3p1p.fsf@ucl.ac.uk> <87a75eap8k.fsf@gnu.org> <87y2sy3kkl.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:43829) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4Ngo-0001WM-2W for emacs-orgmode@gnu.org; Wed, 19 Feb 2020 06:38:50 -0500 In-Reply-To: <87y2sy3kkl.fsf@ucl.ac.uk> (Eric Fraga's message of "Wed, 19 Feb 2020 11:03:56 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: "Fraga, Eric" Cc: Vladimir Nikishkin , "emacs-orgmode@gnu.org" Hi Eric, "Fraga, Eric" writes: > On Wednesday, 19 Feb 2020 at 10:41, Bastien wrote: >> It returned "0" for me, while I guess "." is expected. > > I expected 0 as that is the "value" (i.e. the status in a shell) of > the last command. Quoting the manual: =E2=80=98value=E2=80=99 Default. Functional mode. Org gets the value by wrapping the code in a function definition in the language of the source block. That is why when using =E2=80=98:results value=E2=80=99, code should execut= e like a function and return a value. For languages like Python, an explicit =E2=80=98return=E2=80=99 statement is mandatory when using = =E2=80=98:results value=E2=80=99. Result is the value returned by the last statement in= the code block. "0" is the _exit code_ of the successful echo command, not the value returned by the echo command. So In Vladimir's example, both ":results value" and ":results output" should return the same result, i.e. ".". Was it common to expect the exit code when executing shell code? --=20 Bastien