#!/bin/bash gcd() { local a=$1 local b=$2 if [ $a -eq 0 ]; then echo $b return 0 fi if [ $b -eq 0 ]; then echo $a return 0 fi while [ $b -ne 0 ]; do local temp=$b b=$((a % b)) a=$temp done echo $a } result=$(gcd $1 $2) echo "НОД($1, $2) = $result"