我正在学习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'
出了什么问题?
答案 0 :(得分:1)
在if
和[
之间留出空格。