ubuntu - shell命令没执行完
伊谢尔伦
伊谢尔伦 2017-04-24 09:08:57
0
1
321

需要做一个功能 从ftp下载一个文件 然后解压 用shell写了一个sh如下

#!/bin/bash
echo 111111111111111111111111111111
ftp -n<<!
open 192.168.1.126
user anonymous null
binary
prompt
get $2 $1 
close
bye

echo 222222222222222222222222222222
unzip -o -O UTF8 -d $5 $1 
echo 333333333333333333333333333333

mysql -uhqzn -p111111 -e"use chedi-dev; UPDATE  hq_task_queue SET status='done' Where ID = $3; UPDATE hq_log_TrainSend_Files SET ftped = 'done' Where ID= $4;"
!

运行结果却只打出了111111111111111111111111
也就是说2和3都没有执行
请教如何才能让ftp执行完之后
继续执行后面的命令

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
迷茫

Your heredoc symbol choice is an exclamation point, and the matching second exclamation point goes to the end of the script.

In other words, all statements after bye in the above script are redirected to ftp, instead of being executed by the shell

Solution: Put it! Move to the line after bye.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template