domingo, 29 de noviembre de 2020

A pipe inspector with tee

I've kept writing my scripting-field-guide, adding some more common pitfalls and cool tricks I've used in the last years. 

Something I started using not long time ago is the "tee >()" incantation. It's super cool to be able to branch off the output of a command to another command, and make some sort of tree. 

For now, there's this snippet I created to be able to inspect the contents of a pipe:

The default to the current timestamp isn't going to really work, as the string is evaluated only once, but I hope I'll get something more decent soon.

Another cool usage is when selecting something from a grep/fzf/dmenu and you want to do something with it like open that file, but also copy it to your clipboard.

The clearest example is my daily-zoom-selector, where I'm not just opening the room, but also copying it.

No hay comentarios: