这个shell脚本在ksh环境中不能执行么、、、??
#!/bin/sh
#要求用户输入数值,然后打印出该数值,直到用户输入"end"后才停止
#vi show_var.sh
unset var
echo "please input a number:"
read var
while["$var" != "end"]
do
echo "please input a number again:"
read var
if["$var" = "end"]
then
break
fi
echo "var is : $var"
done shell ksh
[解决办法]
while["$var" != "end"]和if["$var" = "end"]
请用空格将每个单元隔开!
while [ "$var" != "end" ]
if [ "$var" = "end ]
[解决办法]
#!/bin/ksh
#要求用户输入数值,然后打印出该数值,直到用户输入"end"后才停止
#vi show_var.sh
unset var
echo "please input a number:"
read var
while[ "$var" != "end" ]
do
echo "please input a number again:"
read var
if[ "$var" = "end" ]
then
break
fi
echo "var is : $var"
done