99 bottles of beer: Difference between revisions

no edit summary
m (→‎Console: Why make a whole nother call for one character?)
No edit summary
Line 656:
|
\9.>9.>_.>B.>O.>T.t.<---l.<+++e.>>-s.<<<_.>>+++O.<+f.<_.>----b.+++e.E.>>-R.#
 
=={{header|UnixPipes}}==
# Unix Pipes, avoiding all the turing complete sub programs like sed, awk,dc etc.
 
mkdir 99 || exit 1
trap "rm -rf 99" 1 2 3 4 5 6 7 8
 
(cd 99
mkfifo p.b1 p.b2 p.verse1 p.wall p.take
yes "on the wall" > p.wall &
yes "Take one down and pass it around, " > p.take &
(yes "bottles of beer" | nl -s\ | head -n 99 | tac | head -n 98 ;
echo "One bottle of beer";
echo "No more bottles of beer") | tee p.b1 p.b2 |
paste -d"\ " - p.wall p.b1 p.take | head -n 99 > p.verse1 &
cat p.b2 | tail -99 | paste -d"\ " p.verse1 - p.wall | head -n 99
)
rm -rf 99
418

edits