Download with browse with bash and wget
Been pretty busy for last couple of days. Will be busy for another few days, but here’s something to munch in the meantime (Script may need changes depending on the type of file you want to download or the site you are browsing, but the chnages should be minimal):
file=”/tmp/temp.dir”
url=”URL Here”
IFS=’
’
cont=”y”
while [ $cont != ”n” ]
do
name=””
wget ”$url” -O $file -o /dev/null
for i in $(grep href $file |grep -v Parent)
do
name=${i##href=”}
name=${name%%”>}
echo $name
if [[ $name == *gz ]]
then
cont=”n”
fi
done
if [ ! $name ]
then
echo ”No files here.. Exiting”
exit -1
fi
echo
if [ $cont == ”n” ]
then
echo ”Enter the filename for download :”
read file
fi
echo ”Select one of the options:”
read product
url=”$url/$product”
echo ”About to get $url”
done
wget ”$url” -O $file -o /dev/null
I have used the script on Solaris 8/9 and Fedora 9/10.
Related Articles:
- 2010/04/11 Jokes – many to be downloaded once..
- 2010/03/23 unbound variable – bash completion not working and having issues with other stuff like command not found.
- 2010/01/07 shell — one liner to selectively change case
- 2010/05/07 bash script to periodically change the cursor theme.
- 2010/05/05 xterm – select font name and size from command line and set it as default
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.