From: Patrick Steinhardt Date: Fri, 16 Aug 2024 10:52:05 GMT Subject: Re: [PATCH v2 1/8] git-prompt: use here-doc instead of here-string Message-ID: In-Reply-To: <1407516636.4490130.1723801035574@mail.yahoo.com> On Fri, Aug 16, 2024 at 09:37:15AM +0000, avih wrote: > On Friday, August 16, 2024 at 11:50:12 AM GMT+3, Patrick Steinhardt wrote: > > On Thu, Aug 15, 2024 at 01:14:06PM +0000, Avi Halachmi (:avih) via GitGitGadget wrote: > >> -    done <<< "$output" > >> +    done <<-OUTPUT > >> +        $output > >> +    OUTPUT > > > > I was a bit sceptical at first whether this produces the correct output, > > because I wasn't sure whether the first line might be indented while the > > others wouldn't be. And that would only happen if we indented with > > spaces, but when indenting with a tab it seems to work as expected. > > That's what the "-" does in "<<-". It strips leading input tab chars > at the content and the last line, and was specified as such since the > first POSIX release in 1994: > >   If the redirection symbol is <<−, all leading tab characters will >   be stripped from input lines and the line containing the trailing >   delimiter. Oh, I know what `<<-` does. I just wasn't sure how it would behave when "$output" expands to a multi-line string, where subsequent expanded lines might or might not be indented. Patrick