Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jswrenn/turnout-for-what
Shell utility for conditional redirection.
https://github.com/jswrenn/turnout-for-what
Last synced: about 1 month ago
JSON representation
Shell utility for conditional redirection.
- Host: GitHub
- URL: https://github.com/jswrenn/turnout-for-what
- Owner: jswrenn
- Created: 2016-10-05T02:06:06.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-08T17:42:54.000Z (about 8 years ago)
- Last Synced: 2024-10-14T16:47:20.165Z (3 months ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
================
turnout-for-what
================
.. image:: https://upload.wikimedia.org/wikipedia/commons/a/a2/V%C3%BDm%C4%9Bna_hrotit%C3%A1.jpgUsage
-----
::tfw SWITCH
``SWITCH``
A file descriptor yielding a stream of line-separated paths. For every line received from stdin, the last path received from SWITCH indicates the file that the line should be redirected to.Example
-------
A load-balancer for the natural numbers::#!/usr/bin/env bash
trap "rm -f nat {0..4}; pkill -P $$" EXIT
touch nat {0..4}
while true; do
echo $((i++))
sleep 0.2;
done > nat &tail -f nat | cargo run -- <(tail -f nat | xargs -I{} expr {} % 5) &
while true; do
sleep 0.2
clear
wc -l {0..4}
doneThis script will create five text files, balance the natural numbers
between them, and continuously print their line counts.