RosettaCodeData/Task/Integer-comparison/UNIX-Shell/integer-comparison-1.sh

23 lines
432 B
Bash

#!/bin/ksh
# tested with ksh93s+
builtin printf
integer a=0
integer b=0
read a?"Enter value of a: " || { print -u2 "Input of a aborted." ; exit 1 ; }
read b?"Enter value of b: " || { print -u2 "Input of b aborted." ; exit 1 ; }
if (( a < b )) ; then
printf "%d is less than %d\n" a b
fi
if (( a == b )) ; then
printf "%d is equal to %d\n" a b
fi
if (( a > b )) ; then
printf "%d is greater than %d\n" a b
fi
exit 0