这个shell可以成功运行,并且mysql添加了一条记录
#!/bin/nash
i=1;
mysql -uroot -p123456 test -e"insert into user(username,gender,birthday) values('hello$i','man',NOW());"
exit 0
但是当我想在很大程度上插入到mysql数据中时,在shell中我添加了while和do,它会提醒错误
#!/bin/nash
i=1;
while[$i -le 1000]
do
mysql -uroot -p123456 test -e"insert into user(username,gender,birthday) values('hello$i','man',NOW());"
let i=i+1
sleep 0.01
down
exit 0
它会像这样
./insert.sh:line 3:while[1- le 1000]:command not found
./insert.sh:line 4:syntax error near unexpected token 'do'
./insert.sh:line 4:'do'