for((;;)){ IFS=/ read a b x=a for((y=b;x=y%(y=x);)){ :;} echo $[a/y]/$[b/y] }|sed s,/1$,,