Skip to content

Instantly share code, notes, and snippets.

@Pk13055
Created December 27, 2018 17:59
Show Gist options
  • Save Pk13055/dce290dc9cf1a9aaa68713edb1c2571f to your computer and use it in GitHub Desktop.
Save Pk13055/dce290dc9cf1a9aaa68713edb1c2571f to your computer and use it in GitHub Desktop.

Revisions

  1. Pk13055 created this gist Dec 27, 2018.
    14 changes: 14 additions & 0 deletions parallel.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/bash

    url=$1
    file_size=`curl -sI "$1" | grep "Content-Length" | head -n 1 | cut -d ':' -f 2 | cut -d " " -f 2 | sed "s|\r||g"`
    length_of_each_part=`echo $((file_size/10))`
    start=0
    end=$length_of_each_part

    for i in {1..10}
    do
    curl -s --range $start-$end -o /tmp/movie.part."$i" "$url" &
    start=$((end+1))
    end=$((end+length_of_each_part))
    done