Hello all, I'm just getting into bash scripting, and I really need some help. I have initially picked something valuable to me, fanfics. They have a bad habit of disappearing, and having a local copy would be nice. Hence, I'm trying to write a script to do so. This is what I have right now:
Code:
#!/bin/bash
#This is the script I invoke to download FFs
_zenity="/usr/bin/zenity"
basename="/usr/bin/basename"
curr=1
#domain=$(${_zenity} --title "Enter domain" \
# --entry --text "Enter the domain you would download from" )
domain=http://www.fanfiction.net/s/2428341/40/
#chapter=$($basename $domain) #should result in integer
chapter=${domain:36:35} #should result in integer
domain=${domain:0:${#domain} - 3} #should result in something like http://www.fanfiction.net/s/2428341/
while [ "$curr" != "$chapter"]
do
echo -n "$domain""$curr" > list.txt
$curr=$(( $curr + 1))
done
wget -p -k -input-file=./list.txt
echo Download Complete
It doesn't work. I've temporarily hard-coded a variable, but zenity is working. Could someone either fix it, or just write one for me, as I can then try to understand it and keep learning that way. Thanks.