#!/bin/bash
read x
read y
if [ $x -lt $y ] then
echo "X is less than Y"
fi
if [ $x -gt $y ] then
echo "X is greater than Y"
fi
if [ $x -eq $y ] then
echo "X is equal to Y"
fi
答案 0 :(得分:1)
您的脚本存在语法错误。将“ then”放在“ if”下方,如下所示:
if [ $x -lt $y ]
then
echo "X is less than Y"
fi
if [ $x -gt $y ]
then
echo "X is greater than Y"
fi
if [ $x -eq $y ]
then
echo "X is equal to Y"
fi
该脚本将起作用:-)。