Download with browse with bash and wget

2010-05-09 157 words 1 min read

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.


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it