[Toybox] [PATCH] sh: pass "\" to the later app

Rob Landley rob at landley.net
Fri Jun 30 17:57:11 PDT 2023


> On 6/12/23 19:40, Chet Ramey wrote:
>> I wish you were not so reluctant. Look at how many things you've discovered
>> that I decided were bugs based on our discussions.
>
> But since you asked, today's new question I wrestled with was

Why does eval "" clear $? when a normal newline doesn't, and it's passed into
and out of eval otherwise?

  $ false
  $ eval ""
  $ echo $?
  0
  $ false
  $
  $ echo $?
  1
  $ false; eval 'echo $?'
  1
  $ eval 'false'; echo $?
  1
  $ if ; then echo hello; fi
  bash: syntax error near unexpected token `;'
  $ if
  > then echo hello; fi
  bash: syntax error near unexpected token `then'

What's the logic here? Probably related to:

  $ if $NONE; then echo hello; fi
  hello

Rob


More information about the Toybox mailing list