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 : Lem (at) *nospam* none.invalid (Lem Novantotto)
Groupes : comp.unix.shell
Date : 01. Nov 2024, 16:39:37
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vg2snp$36bh5$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Pan/0.160 (Toresk; )
Il Fri, 1 Nov 2024 09:01:15 -0000 (UTC), Kenny McCormack ha scritto:

I think I actually prefer to stick with; > >(cmd ...)

Note that

cat << EOF | grep . ; echo end

and also

(cat | grep .) << EOF ; echo end

produce the same output:
---------------------------------------------------------
lem@biggy:~$ cat << EOF | grep . ; echo end
start
EOF
start
end
lem@biggy:~$
---------------------------------------------------------
lem@biggy:~$ (cat | grep .) << EOF ; echo end
start
EOF
start
end
lem@biggy:~$
---------------------------------------------------------

Instead with "cat << EOF > >(grep .) ; echo end" the output is
unpredictable. You can very well get, as usual:
---------------------------------------------------------
lem@biggy:~$ cat << EOF > >(grep .) ; echo end
start
EOF
start
end
lem@biggy:~$
---------------------------------------------------------
OR maybe:
---------------------------------------------------------
lem@biggy:~$ cat << EOF > >(grep .) ; echo end
start
EOF
end
start
lem@biggy:~$
---------------------------------------------------------
OR even, most of the time:
---------------------------------------------------------
lem@biggy:~$ cat << EOF > >(grep .) ; echo end
start
EOF
end
lem@biggy:~$ start [you press ENTER here and get back an empty prompt]

lem@biggy:~$
---------------------------------------------------------

So sometimes it's better to be careful. :)
--
Bye, Lem

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