Skip to main content
edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 265
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.5k
  • 205
  • 1.8k
  • 2.3k
Source Link
reox
  • 243
  • 1
  • 2
  • 8

replacement inside parallel command string

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?