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 : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shell
Date : 04. Nov 2024, 00:49:14
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vg925r$jcoe$1@dont-email.me>
References : 1 2
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 03.11.2024 21:37, Helmut Waitzmann wrote:
 gazelle@shell.xmission.com (Kenny McCormack):
>
I just want to know if the basic syntax is valid and/or if there is a
better workaround (better than switching to: > >(...))
 
 Either use a backslash for unfolding a folded line (as Ben
 showed) or put the part of the command line following the pipe
 symbol ("|") after the EOF of the here document (as Janis showed)
 or embrace the simple command and its here document by "{ ... ;
 }":
 
 
   {
     someCommand -x -y "sjdfhk" and more options \
         -g and still more options -Q "another option" << EOF
   some data
   for someCommand
   EOF
   } |
       /usr/lib/ANotherCommand -x "with option" and "more options"
 

In this vein (i.e. structuring the code) another option is to put
all these long commands with all their options into functions, so
that the complex command calls fit (with the pipes, and without
escapes) on a single line

  f_someCommand <<EOF | f_anotherCommand
  ...
  EOF

(This could make the code also better readable and maintainable.)

Janis


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