Skip to content

Instantly share code, notes, and snippets.

Created September 26, 2014 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2e5c9de580f330bca1a6 to your computer and use it in GitHub Desktop.
Save anonymous/2e5c9de580f330bca1a6 to your computer and use it in GitHub Desktop.
#!/bin/bash
function generator() {
local I=1
while [ $I -le 50 ]; do
echo "Line $I"
let I+=1
done
}
function alternator() {
local LN=0
while read -r LINE; do
test $((LN % 2)) -eq 0 && echo "$LINE" || echo "$LINE" 1>&2
let LN+=1
done
}
generator | alternator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment