从 bash 脚本调用 wget 和 curl 时速度要慢得多
我正在编写一个小自动化脚本,我需要下载一个文件。当我直接从 bash 使用curl 或 wget 时,平均 dl 速度约为 3MB/s。然而,当我从 bash 脚本调用它时,下载速度下降到 300kB/s。对于curl 和wget 都会发生这种情况。
我在 OS X 上,使用 bash 3.2.48、wget 1.12 和curl 7.19.7
编辑:脚本 - 到目前为止只是这个片段。我刚刚尝试了一下,发现了这个问题...
#!/bin/bash
CURVER=1.0
VERSION=1.2
if [ ${VERSION//\./} -gt ${CURVER//\./} ]; then
echo "There is a new version available!"
wget -O /tmp/dl.dmg $DOWNLOAD
fi
I'm writing a little automation script and I need to download one file. When I use curl or wget directly from bash, the average dl speed is about 3MB/s. However, when I invoke it from the bash script, the download speed drops to 300kB/s. It happens for both curl and wget.
I'm on OS X, with bash 3.2.48, wget 1.12 and curl 7.19.7
EDIT: the script - it's just this snippet so far. I just tried it and found that issue...
#!/bin/bash
CURVER=1.0
VERSION=1.2
if [ ${VERSION//\./} -gt ${CURVER//\./} ]; then
echo "There is a new version available!"
wget -O /tmp/dl.dmg $DOWNLOAD
fi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
非常奇怪!
您执行脚本的用户是否与从命令行尝试使用的用户相同?
也许该脚本是由具有某种会减慢连接速度的策略的用户运行的?
EXTREMELY WEIRD!
Are you executing the script with the same user than the one you use to try it from command line?
Maybe the script is ran by a user with some type of policy that slowdown connection?