[Toybox] Would someone please explain what bash is doing here?

Rob Landley rob at landley.net
Sun May 24 14:05:09 PDT 2020


On 5/24/20 3:46 PM, Chet Ramey wrote:
>> No, I meant the LINENO on the second line isn't noticing it's on a later line,
>> it's now reporting the first line for both LINENOs, and I thought my initial
>> confusion was about it NOT doing that?
> 
> I'm not sure myself.
> 
> The backslash-newline gets removed, so the command is a single logical
> line, which, since the lexer was on line 1 when the parser figured out it
> was parsing a simple command, is all on line 1. The simple command gets
> the line number where the lexer is when the parser reduces to a simple
> command. That's definitely a yacc/bison artifact.

In new tab:
  $ echo $LINENO \
  > $LINENO
  1 1
  $ echo $LINENO
  3

In new tab:
  $ echo $LINENO\
  > $LINENO
  22
  $ echo $LINENO
  3

It cares about the space.

Right, nevermind. I'm just resolving it to the line number at the start of the line.

Rob



More information about the Toybox mailing list