Files
lab1/script_LCM.sh

19 lines
246 B
Bash
Executable File

#!/bin/bash
if [ $# -ne 2 ]; then
echo "error, pls write 2 arguments"
exit 1
fi
a=$1
b=$2
GCD=$(bash ./script_GCD.sh $a $b | head -n1)
if ! [[ "$GCD" =~ ^[0-9]+$ ]]; then
echo "Error"
exit 1
fi
echo $(( ($a * $b) / $GCD ))