Created
May 25, 2016 00:34
-
-
Save secvalve/fbe41b7cc45812e386c6c8ea95075d3c to your computer and use it in GitHub Desktop.
A bash script that uses CURL to get a file in parts, ala axel. Usage: baxel numparts url eg ./baxel 3 http://www.google.com/robots.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#$1 numparts, #$2 url | |
#Get length | |
TL=$(curl -sI $2 | grep Content-Length | awk '{printf "%d", $2}') | |
echo "$s is $TL Bytes Long” | |
#GetChunks | |
for i in `seq 0 $(( $1 - 1 ))`; | |
do | |
echo $(curl -r $(( i * (TL / $1) ))-$(( ( i + 1 ) * ( TL / $1 ) )) $2) | |
done | |
#if even get the last bit | |
if [ $(( TL % 2 )) = 1 ]; | |
then echo $(curl -r -1 $2) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment