Oct 5, 2007
Useful script for downloading on linux
I always go through the same three steps to download a file (in tar.gz format)
- wget the tar.gz file I want
- untar it
- remove the original file I downloaded
So I made a bash script that does those three steps in one. Use it the same way as wget (# simple.sh http://path/to/file.tar.gz)
#!/bin/bash
# change this to whatever extension you'd like to handle
ext=".tar.gz"
# flags to pass to tar
flg="-zxvf"
wget $1
file=`ls -t *$ext | grep -i -m 1 "^.*$ext$"`
if [[ -n $file ]]
then
tar $flg $file
unlink $file
else
echo "Could not find the downloaded file."
fi
You can download it via this link (Remember to make it executable and to change its extension)
One Comment, Comment or Ping
lewis
pipe is your friend!
wget -O - | tar zxf -
Dec 2nd, 2007
Reply to “Useful script for downloading on linux”