On 04/09/2021, ropers <rop...@gmail.com> wrote:
> On 04/09/2021, Marc Chantreux <m...@unistra.fr> wrote:
>> Another solution is to write commands for this kind of tasks:
>>
>> <<\. cat > ~/x
>> #! /bin/ksh
>>
>> sed -r 's/a/&\
>> /g'
>> .
>
> Wait, hold up, I'm not familiar with this input redirection idiom.
> Could you explain?  Why the double <, and why does it not work with a single
> <?
> Also, could you explain the escaped period?[0]  This is very hard to
> google.

I've realised the <<char redirection is a Here Document, which is very
googleable.  (Silly me.  My excuse --that I'm sticking to-- is that
the order and lack of whitespace also threw me, as I've more often
seen this put thus:
cat << HERE > ~/x)

But I still don't understand why you escaped the dot.  Is that just an
overly cautious hypercorrection, or is there some reason I should
escape periods in such cases?  An unescaped full stop works fine for
me.

Ian

Reply via email to