Re: Using << and an output pipe together in shell (bash)

Liste des GroupesRevenir à cu shell 
Sujet : Re: Using << and an output pipe together in shell (bash)
De : gazelle (at) *nospam* shell.xmission.com (Kenny McCormack)
Groupes : comp.unix.shell
Date : 01. Nov 2024, 00:05:20
Autres entêtes
Organisation : The official candy of the new Millennium
Message-ID : <vg12fg$3tq77$1@news.xmission.com>
References : 1 2
User-Agent : trn 4.0-test77 (Sep 1, 2010)
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.

Date Sujet#  Auteur
31 Oct 24 * Using << and an output pipe together in shell (bash)10Kenny McCormack
31 Oct 24 +- Re: Using << and an output pipe together in shell (bash)1Janis Papanagnou
1 Nov 24 +* Re: Using << and an output pipe together in shell (bash)6Ben Bacarisse
1 Nov 24 i`* Re: Using << and an output pipe together in shell (bash)5Kenny McCormack
1 Nov 24 i +* Re: Using << and an output pipe together in shell (bash)3Janis Papanagnou
1 Nov 24 i i`* Re: Using << and an output pipe together in shell (bash)2Kenny McCormack
1 Nov 24 i i `- Re: Using << and an output pipe together in shell (bash)1Lem Novantotto
1 Nov 24 i `- Re: Using << and an output pipe together in shell (bash)1Kaz Kylheku
3 Nov 24 `* Re: Using << and an output pipe together in shell (bash)2Helmut Waitzmann
4 Nov 24  `- Re: Using << and an output pipe together in shell (bash)1Janis Papanagnou

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal