bug-bash
[Top][All Lists]
Advanced

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

Re: Clarify cases of implicit and explicit line continuation


From: Chet Ramey
Subject: Re: Clarify cases of implicit and explicit line continuation
Date: Fri, 1 Jun 2018 08:48:36 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 6/1/18 1:28 AM, Shriramana Sharma wrote:
> Hello. See 
> https://unix.stackexchange.com/questions/253518/where-are-bash-line-continuations-after-and-documented.
> 
> Roughly put, wherever lines terminating with a particular token are
> syntactically valid, they are taken as complete, and an explicit \ is
> required to continue the line, but lines ending with && || or I and
> lines where an array definition has been started with =( but not
> closed with a ) implicitly continue to the next physical line. 

The general rule is simple: bash reads input a line at a time, feeding
each line to the parser, until it has enough input for a complete
command. If it doesn't have enough to complete a command, it will read
additional lines. If a newline would complete a command, you need to
quote it to prevent it being interpreted as such.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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