我想这个bash脚本到:
- 读取和文件的内容分配给
URLS
- 提示用户输入一个路径来下载内容,将其分配给
PATH
- 通过URL遍历
- 使用wget将内容下载到PATH。
这里是我到目前为止有:
#!/bin/bash
URLS=$(<urls.txt)
read -e -p "Please enter the path of the directory you'd like to save your files to: " PATH
for link in $URLS
do
wget --background --tries=45 $URLS --directory-prefix $PATH
done
exit 0
我的直觉是,我没有使用正确$PATH
与wget
,因为该脚本将正常运行,如果我注释掉--directory-prefix $PATH
。
在此先感谢您的帮助。
它没有注释掉'--directory-prefix $ PATH',它有所作为(用于'wget:command not found'的目的),但注释掉'read PATH'。 –