Files
lab_git/script_main.sh
2026-02-27 14:54:16 +03:00

26 lines
564 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
SCRIPT_DIR="$(dirname "$0")"
echo "=== Калькулятор НОД и НОК ==="
read -p "Введите первое число: " num1
read -p "Введите второе число: " num2
if ! [[ "$num1" =~ ^[0-9]+$ ]] || ! [[ "$num2" =~ ^[0-9]+$ ]]; then
echo "Ошибка: введите целые положительные числа!"
exit 1
fi
echo ""
echo "Результат НОД:"
bash "$SCRIPT_DIR/script_GCD.sh" $num1 $num2
echo ""
echo "Результат НОК:"
bash "$SCRIPT_DIR/script_LCM.sh" $num1 $num2