我无法在shellscript中调试一个简单的错误

时间:2013-12-10 06:25:14

标签: mysql linux shell

我正在学习shell脚本..

这很好用

#!/bin/bash
temp = "test" 
if["$temp" = "test"]; then
   echo "true"
else
   echo "false"
fi

但这不起作用

#!/bin/bash 
while (true) ; do 
test=$(exec /usr/bin/mysql -u root -p"password" databasename  -N -s -e "select seq  from table limit 1 ") 
echo $test; 
if[ "$test" = "" ]; then 
    exec ./do_Something.sh $test 
else 
    echo "." 
fi 
    sleep 30 
done 

错误消息

./tes.sh: line 5: syntax error near unexpected token `then' 
./test.sh: line 5: `  if[ "$test" = "" ]; then' 

出了什么问题?

1 个答案:

答案 0 :(得分:1)

if[之间留出空格。