Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Download file from from linux console with bash script
#!/usr/bin/env bash
# idea:
[ -z "$FILENAME" ] && {
echo "Syntax: `basename $0` <url> <dst_path>" >&2
exit 1
URLPART0=$(wget --quiet -O - $URL | grep -o '"weblink_get":\[[^]]\+\]' | sed 's/.*"url":"\([^"]\+\)".*/\1/')
URLPART1=$(echo $URL | awk -F '/public/' '{print $2}')
URLPART2=$(wget --quiet -O - "" | sed 's/.*"token":"\([^"]\+\)".*/\1/')
wget --no-check-certificate --referer=$URL "$URLPART0/$URLPART1/$FILENAME?key=$URLPART2" -O $FILENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.