[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: is there a way to use a work buffer in Linux bash? ...



On Tue, Dec 23, 2025 at 10:20:29AM +0100, Michel Verdier wrote:
> On 2025-12-23, tomas@tuxteam.de wrote:
> 
> > On Mon, Dec 22, 2025 at 10:06:36PM +0000, Albretch Mueller wrote:
> >> It comes really handy whenever you need to work with a buffer of bytes more than once. No extra objects created.
> >> I think internally bash does have such things. Otherwise how could two strings be compared?
> >> As an equivalent to ANSI C's memcpy and memmove in java they use java.lang.System.arraycopy
> >
> > For bash (well, more precisely for that Unix-y thing bash
> > binds together, with all the textutils and binutils), the
> > buffer is the file. Has always been. The interface is a
> > bit different to your run-of-the-mill language, but then
> > bash is
> 
> And if Albretch set this file on tmpfs (i.e. in /run) he would get his
> memory buffer.

The buffer cache is actually pretty good at such things. You won't hit
disk too often unless RAM is tight, in which case tmpfs wouldn't be
a good idea anyway.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: