[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: potential addition of sponge to POSIX
|
From: |
Marc Chantreux |
|
Subject: |
Re: potential addition of sponge to POSIX |
|
Date: |
Fri, 20 Jun 2025 10:52:43 +0200 |
On Fri, Jun 20, 2025 at 08:32:16AM +0200, Bernhard Voelker wrote:
> On 6/19/25 18:55, Marc Chantreux wrote:
> > so out of curriosity: is there another possible usage ?
>
> Maybe the 'sed -i ... FILE' case?
sorry for my poor english. what I was saying is "I don't know any
other way of using sponge than make sure every rhs of the pipe
is closed before releasing data to the remain components.
sed -i obvioulsy doesn't work with pipes.
> Support in a general way could look like:
>
> sponge-tool FILE cmd args...
>
> where 'sponge-tool' passes the content of FILE to stdin of 'cmd',
> and writes the stdout back to FILE.
well.
* sponge is more generic
* as long as you have sponge, you can write stuff like that
inline() {
local SELF="$1"; shift
"$@" "$SELF" | sponge "$SELF"
}
I did it long time ago before I realized I didn't use it
because it's so easy to write
set A B C D
for it; do grep foo $it | sponge $it; done
even shorter with shells with non-algol control statements
(zsh, rc, es, …)
set A B C D
for it { grep foo $it | sponge $it }
for it (A B C D) { grep foo $it | sponge $it }
Regards
--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79
- potential addition of sponge to POSIX, Eric Blake, 2025/06/19
- Re: potential addition of sponge to POSIX, Pádraig Brady, 2025/06/19
- Re: potential addition of sponge to POSIX, Marc Chantreux, 2025/06/19
- Re: potential addition of sponge to POSIX, Pádraig Brady, 2025/06/19
- Re: potential addition of sponge to POSIX, Marc Chantreux, 2025/06/20
- Re: potential addition of sponge to POSIX, Michael Stone, 2025/06/20
- Re: potential addition of sponge to POSIX, Marc Chantreux, 2025/06/21
- Re: potential addition of sponge to POSIX, Rob Landley, 2025/06/26
- Re: potential addition of sponge to POSIX, Marc Chantreux, 2025/06/27
- Re: potential addition of sponge to POSIX, Bernhard Voelker, 2025/06/20
- Re: potential addition of sponge to POSIX,
Marc Chantreux <=
File a request to Austin group ?, Marc Chantreux, 2025/06/19