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