Deutsch   English   Français   Italiano  
<vg12fg$3tq77$1@news.xmission.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.snarked.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: Using << and an output pipe together in shell (bash)
Date: Thu, 31 Oct 2024 23:05:20 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vg12fg$3tq77$1@news.xmission.com>
References: <vg0q7d$3tlel$2@news.xmission.com> <87r07v99wd.fsf@bsb.me.uk>
Injection-Date: Thu, 31 Oct 2024 23:05:20 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
	logging-data="4122855"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
Bytes: 1779
Lines: 39

In article <87r07v99wd.fsf@bsb.me.uk>, Ben Bacarisse  <ben@bsb.me.uk> wrote:
....
>I think you need "| \" at the end of this line.  At least that's what I
>usually do and it seems to work.

It is not generally necessary to put a backslash at the end of a line that
ends with | (in shell script).

But it *is* necessary in this special case!  So, you get the prize.
Note that this solves it as far as getting bash to be happy with it is
concerned.  When I get a chance, I need to see about how VIM feels about it.

Here's test case:

 $ nl << EOF | nl
test
this
EOF
     1       1  test
     2       2  this
$ nl << EOF |
nl
test
this
EOF

-bash5: syntax error: unexpected end of file
Status: 2
 $ nl << EOF | \
nl
test
this
EOF
     1       1  test
     2       2  this
 $

-- 
It's possible that leasing office space to a Starbucks is a greater liability
in today's GOP than is hitting your mother on the head with a hammer.