G
G
Grigory Vasilkov2017-02-10 09:41:15
linux
Grigory Vasilkov, 2017-02-10 09:41:15

How to set wget -O option with dynamic page name?

wget -O file "url?param1=1¶m2=2" will always write to "file"
wget "url?param1=1¶m2=2" will always write to "url?param1=1¶m2=2"
Interested in writing to files wget_output1.txt , wget_output2.txt etc for each run

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abcd0x00, 2017-02-13
@gzhegow

make_name()
{
    echo "file_$(date '+%Y-%m')_$1.txt"
}

for i in 1 2 3; do
    wget -O "$(make_name $i)" "https://www.yandex.ru"
done

Result
[[email protected] tmp]$ ls *.txt
file_2017-02_1.txt  file_2017-02_2.txt  file_2017-02_3.txt
[[email protected] tmp]$

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question