Re: [dev] I didn't know that you could use the shell like this: compound pipe?

From: Jeremy <jer_AT_jer.cx>
Date: Wed, 17 Jan 2024 16:22:38 -0800

I hate to assume your motives are bad-hearted, but I'm
not sure if you're trolling or something?

On 01/17/24 07:00PM, 201009-suckless_AT_planhack.com wrote:
> Use files.
>
> ./program-cli | (
> read -r
> printf "%s\n" "$REPLY" > /tmp/a
> ) > /tmp/b
> fooify /tmp/a
> barify /tmp/b
> ....
>

To correct the above program:

```
./program-cli | (
read -r
printf "%s\n" "$REPLY" > /tmp/a
cat
) > /tmp/b
fooify /tmp/a
barify /tmp/b
```

If you don't add `cat`, the body of the output is consumed by the dead
subshell & you'd end up with nothing to barify, and that's a fact.

but why add cat if you can barify right there?


to further correct the above program, assuming barify reads from stdin:

```
./program-cli | (
read -r
printf "%s\n" "$REPLY" > /tmp/a
barify
) > /tmp/b
fooify /tmp/a
```

"Use files" - I will never forget this.

Jeremy
Received on Thu Jan 18 2024 - 01:22:38 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 18 2024 - 01:24:07 CET