Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to download multiple files and save them to the md5 sum of its name:

cat list | parallel -j4 "md5=$(wget -O - {} | tee tmpfile_{#} | md5sum | cut -d ' ' -f 1); mv tmpfile_{#} $md5"

but the problem is that bash seems to execute the wget stuff before execution of parallel replaces {}... so wget wants to download from http://{}

so how can parallel replace its variables before the execution of the subcommand?

share|improve this question

some trial and error later:

cat list | parallel -j4 'md5=$(wget -O - {} | tee tmpfile_{#} | md5sum); mv tmpfile_{#} ${md5%% *}'

just replace " with ' does not allow bash to replace something first

share|improve this answer
You might also want to read about Word Splitting. – Rany Albeg Wein Apr 25 '13 at 0:42
Following the manual or a guide is usually better than doing trial-and-error – ignis Apr 27 '13 at 17:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.