我正在学习 shell 脚本,我想获取变量的输入
mynum
我的脚本不起作用:
#!/bin/bash
mynum
echo -n "Please enter the number to validate--->"
read mynum
if [ mynum -eq 100 ]
then
echo "mynum is equal to 100"
else
echo "mynum is not equal to 100"
fi
帮帮我吧。
答案1
最后我得到了它 !!!
#!/bin/bash
read -p "Please enter the number to validate :" mynum
#mynum=234
if [ $mynum -eq 100 ]
then
echo "mynum is equal to 100"
else
echo "mynum is not equal to 100"
fi
./is
Please enter the number to validate :345
mynum is not equal to 100