here's the final version of the "redirects cheat sheet" draft I posted a while back!

("The Secret Rules of the Terminal" is finished! 95 beta readers have read it! the copy editor is done! technical review is done! the illustrator has made the cover! It's going to be out on *****Tuesday June 24*****")

95 beta readers is a new record, I used to ask maybe 1-2 people to read a zine before it went out but this one went through 4 rounds of beta readers who made it a LOT better than it started
@b0rk yay for playtesting for zines!
@b0rk it was a fun read, looking forward to the finished version
@b0rk Nice! I always forget how to do the stderr redirects... For gotcha 1, have you seen `sponge` from moreutils? https://joeyh.name/code/moreutils/
moreutils

@effigies yeah it seems very reasonable! i have a rule about not including tools that I have never personally used though, it's too hard for me to evaluate/recommend them

@effigies @b0rk
Is sponge very different from tee? Man page makes it sound like it doesn't print its input but sounds same otherwise?

Must admit, I'm not sure if `cat file | tee file` would delete the file.

@idbrii @effigies this stack overflow answer gives an example where tee and sponge have different results https://stackoverflow.com/questions/33638511/differences-between-sponge-and-tee/68606136#68606136
@b0rk having to remember what 0, 1 and 2 mean doesnnt make sens. That's why I like the approach nushell took with letters https://www.nushell.sh/lang-guide/chapters/pipelines.html
Pipelines | Nushell

A new type of shell.

@b0rk I would like to mention that `:> file.txt` is the same as `touch file.txt` in the sense that it creates an empty file. Pretty cool.
Maybe I have learned this from Veronica Explains but I'm not sure.
@IndigoPRNG @b0rk : is a no-op, so it’s a cool use of this.
@b0rk is there a way to order now online?
@b0rk and will it be included in the 'full pack' of all zines? i can probably order full set of printed copies thru school in the future for teaching, etc.
@pg it will! you can't order it until Tuesday though
@b0rk great, i may order a set for myself first to check it out, i always appreciate printed materials

@b0rk I am fond of <(do some command) which bash and some other shells support. As an example, after have gzipped and split a large file (e.g. a .iso) onto a cd or dvd, you can make sure the result of the gzip'ed splitting matches the original with

cmp foo.iso <(cat splitfoo* | gzip -cd -)

(I know that final - isn't necessary, but I like to make it explicit.)

@b0rk huh, which shells do &|? bash does |&, and it kinda feels like the canonical implementation 😅

@b0rk One thing that confuses people is the combination with user permissions.

```
sudo cat ~/allowed_file > /root
```

doesn't work because the user's shell runs the `>` redirection, and it doesn't have permissions to write to `/root`. The `sudo` part is useless, as the user is allowed to read the file anyway.

Instead, the output needs to be piped into a tool running as the appropriate user.

I tend to use `tee` for that. It's main purpose is to duplicate a stream to both 1) stdout and 2) a file, but here, we want 2), run as root.

```
cat ~/allowed_file | sudo tee /root >/dev/null
```

The redirection is for the output from 1), as it's not needed here.

@b0rk &> is not POSIX though. If you’re on a minimal system with /bin//sh only your script will not work
@b0rk hi, process substitution (https://mywiki.wooledge.org/ProcessSubstitution) is a great tool in the same family, e.g. :
```
diff <(sort list1) <(sort list2)
```