compare two digital

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了compare two digital相关的知识,希望对你有一定的参考价值。

#! /bin/bash
read -p "please input two numbers:" a b
if [ -z "$a" ] || [ -z "$b" ];then
echo " please input digital."
exit 2
fi
expr $a + 1 &> /dev/null
a1=echo $?
expr $b + 1 &> /dev/null
b1=echo $?
if [ "$a1" -ne 0 ] || [ "$b1" -ne 0 ];then
echo "you input is not digital."
exit 2
fi

if [ $a -gt $b ];then
echo "$a is bigger than $b."
elif [ $a -eq $b ];then
echo "$a equal $b"
else
echo "$a is small than $b"
fi

以上是关于compare two digital的主要内容,如果未能解决你的问题,请参考以下文章

[Shell] Compare two files.

[LeetCode] 844. Backspace String Compare_Easy tag: Stack **Two pointers

Add Two Numbers

在 Javascript 中使用闭包

leetcode-2-Add Two Numbers

2. Add Two Numbers 两个数字相加