* Re: here-string or echo ?
@ 1991-10-02 19:15 Chet Ramey
0 siblings, 0 replies; 3+ messages in thread
From: Chet Ramey @ 1991-10-02 19:15 UTC (permalink / raw)
To: malte; +Cc: rc
> Which one is more efficient
>
> string='something'
> sed 'expr' <<< $string
>
> or
>
> echo -n $string | sed 'expr'
I'd lay odds that here strings are more efficient.
--
``Teach them politics and war so their sons may study medicine and mathematics
in order to give their children a right to study painting, poetry, music, and
architecture.''
Chet Ramey, CWRU Inet: chet@po.CWRU.Edu NeXT Mail: chet@macbeth.INS.CWRU.Edu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: here-string or echo ?
@ 1991-10-02 19:28 Byron Rakitzis
0 siblings, 0 replies; 3+ messages in thread
From: Byron Rakitzis @ 1991-10-02 19:28 UTC (permalink / raw)
To: rc
Before people start laying odds on anything, why not just look at the code?
Herestrings are implemented with a pipe. echo through a pipe is obviously
implemented with a pipe. Both write their data with one call to write() (or
as many as it takes if write does not go all the way). So barring the
differences in character-munging that the echo builtin and the herestring
implementation might have, the two are equivalent.
*I'll* lay odds that it would take a mighty large string for anyone to be
able to notice, or even measure, the difference.
^ permalink raw reply [flat|nested] 3+ messages in thread
* here-string or echo ?
@ 1991-10-02 16:26 malte
0 siblings, 0 replies; 3+ messages in thread
From: malte @ 1991-10-02 16:26 UTC (permalink / raw)
To: rc
Which one is more efficient
string='something'
sed 'expr' <<< $string
or
echo -n $string | sed 'expr'
?
_______________________________________________________________________________
malte@techfak.uni-bielefeld.de
send mail reply to: Universitaet Bielefeld, Technische Fakultaet
z. Hd. Malte Uhl
Postfach 8640
4800 Bielefeld 1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1991-10-02 19:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-10-02 19:15 here-string or echo ? Chet Ramey
-- strict thread matches above, loose matches on Subject: below --
1991-10-02 19:28 Byron Rakitzis
1991-10-02 16:26 malte
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).