This question is a follow-up of another one asked some time ago.
I currently have this script:
download_data(){
wget --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --auth-no-challenge=on --keep-session-cookies --content-disposition $1
}
export -f download_data
DIR=$(dirname "$1")
<$1 xargs -d $'\n' -P 5 -n 1 -- bash -c 'for arg; do download_data $arg; done' _
In other words, I have a text file with a lot of URLs, one per line, and I feed each one of the URLs to wget to download the data.
What I want to do is to add another parameter to download_data(), in order to select the download location of the file. Something like:
download_data(){
wget -P $1 --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --auth-no-challenge=on --keep-session-cookies --content-disposition $2
}
export -f download_data
DIR=$(dirname "$1")
<$1 xargs -d $'\n' -P 5 -n 1 -- bash -c 'for arg; do download_data $DIR $arg; done' _
Which, in theory, would save the files in the location of my text file. But it does not work: the first argument passed into download_data() is always empty.
I'm quite noob in bash and all this, so it is probably something simple missing...
Thank you for your help!