Hi Eric,
"Fraga, Eric" <[email protected]> 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:
‘value’
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 ‘:results value’, code should execute like a
function and return a value. For languages like Python, an
explicit ‘return’ statement is mandatory when using ‘:results
value’. 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?
--
Bastien