因此我写了下面的脚本:
#!/bin/bash
echo "Enter a number:"
read num
if [ $num -gt 0 ]; then
echo "$num is positive."
elif [ $num == 0 ]; then
echo "$num is zero."
else
echo "$num is negative."
fi
它给了我syntax error in line 6: then unexpected token
因此我写了下面的脚本:
#!/bin/bash
echo "Enter a number:"
read num
if [ $num -gt 0 ]; then
echo "$num is positive."
elif [ $num == 0 ]; then
echo "$num is zero."
else
echo "$num is negative."
fi
它给了我syntax error in line 6: then unexpected token