#!/bin/bash # GCD a="$1" b="$2" while [ $a -ne 0 ] && [ $b -ne 0 ]; do if [ $a -gt $b ]; then a=$((a % b)) else b=$((b % a)) fi done echo $((a + b))