[英]How to downlaod a file in a directory using wget command in bash script?
I want to download a list of files using "wget" command of linux in a bash script file. 我想使用bash脚本文件中的linux的“ wget”命令下载文件列表。 The problem is that when I am trying to change the directory to another subdirectory in my home, it does not work and the wget after the cd command will download the files in my home directory not the desired subdirectory 问题是,当我尝试将目录更改为我的主目录中的另一个子目录时,它不起作用,并且cd命令后的wget将下载我的主目录中的文件,而不是所需的子目录
mkdir -m 777 "dbback2012"
cd "dbback2012"
wget -r [FTP URL]
The problem is that the downloaded files via wget are in the home directory not the "dbback2012" directory. 问题是通过wget下载的文件位于主目录中,而不是“ dbback2012”目录中。
There's nothing wrong with the code, you either 代码没有错,你要么
pwd
该脚本在其他地方执行,请检查工作目录: pwd
mkdir -m 777 "dbback2012" || (echo "ooops"; exit 1)
该脚本无法创建目录mkdir -m 777 "dbback2012" || (echo "ooops"; exit 1)
mkdir -m 777 "dbback2012" || (echo "ooops"; exit 1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.