【问题标题】:wget does not terminatewget 不会终止
【发布时间】:2017-03-22 21:57:17
【问题描述】:

我的代码有以下问题:

下载完成后,脚本不会终止。它似乎在等待更多的网址。


我的代码:

#!/bin/bash

cd "$1"
test=$(wget -qO- "$3" | grep --line-buffered "tarball_url" | cut -d '"' -f4)

echo test:
echo $test
echo ==============

wget -nd -N -q --trust-server-names --content-disposition -i- ${test}

$test 的示例:

https://api.github.com/repos/matrixssl/matrixssl/tarball/3-9-1-open https://api.github.com/repos/matrixssl/matrixssl/tarball/3-9-0-open

【问题讨论】:

  • -i- 表示从标准输入中读取 URL 列表。因此,它正在等待您输入 URL。
  • 是的,正如我写的那样有效,但我该如何终止它? $test 包含网址。

标签: linux wget


【解决方案1】:

-i 表示从文件中获取 URL 列表,使用- 代替文件表示从标准输入中获取它们。所以它正在等待您输入 URL。

如果$test包含网址,则无需使用-i,只需在命令行中列出网址即可:

wget -nd -N -q --trust-server-names --content-disposition $test

【讨论】:

  • 猜我误解了文档,我认为一个只能处理多个 url 结合-i
猜你喜欢
  • 1970-01-01
  • 2017-12-15
  • 2016-04-16
  • 1970-01-01
  • 1970-01-01
  • 2018-02-02
  • 2017-04-06
  • 2021-06-23
  • 2011-01-08
相关资源
最近更新 更多