#!/bin/sh # gleichstand 3 # gewonnen 6 # A X=Rock 1 # B Y=Paper 2 # C Z=Scissors 3 # sed -e 's/\w \(\w\)/& \1/g' -e 's/X/A/' -e 's/Y/B/' -e 's/Z/C/' \ # -e 's/\(A A\)\|\(B B\)\|\(C C\)/3/' -e 's/\(A B\)\|\(B C\)|\(C A\)/6/' \ # -e 's/[ABC] [ABC] //' -e 's/X/1/' -e 's/Y/2/' -e 's/Z/3/' \ # -e 's/ /+/' /dev/stdin \ # | paste -sd+ cat /dev/stdin | sed -e 's/\w \(\w\)/& \1/g' -e 's/\(A X\)\|\(B Y\)\|\(C Z\)/3/' \ -e 's/\(A Y\)\|\(B Z\)\|\(C X\)/6/' -e 's/[ABC] [XYZ] //' -e 's/X/1/' \ -e 's/Y/2/' -e 's/Z/3/' -e 's/ /+/' | paste -sd+ | bc