Terminal – ls-like command for http directories?
Florian Diesch
diesch at spamfence.net
Sat May 25 15:43:27 UTC 2013
Am Sat, 25 May 2013 14:20:57 +0200
schrieb Johnny Rosenberg <gurus.knugum at gmail.com>:
> Is this possible?
>
> Okay, an example:
> I have a script that downloads and installs unetbootin to my system. I
> run the script like this:
>
> ./Install.sh 583
>
> This downloads and ”installs” Unetbootin 5.83, which means it uses
> wget to download the file, then moves the file to a proper place and
> finally adds a link to it in ~/bin so I can run it by only typing:
> unetbootin
>
> Now, for this to work, I first need to find out what is the latest
> version, for instance by looking it up in my web browser. Then I can
> run my install script.
>
> Of course it would be more convenient if the script could find the
> latest version for me.
>
> The latest version (today, 2013-05-25) is:
> http://tenet.dl.sourceforge.net/project/unetbootin/UNetbootin/583/unetbootin-linux-583
>
> So what I need is a command like:
> some_ls-like_command
> "http://tenet.dl.sourceforge.net/project/unetbootin/UNetbootin/"
> Then I guess I would have a loop that determines the highest value
> somehow, but I guess I will figure that part out.
You can download the page and use awk and friends to the highest
value, e.g.
----------------------------------------------------------------------
URL='http://tenet.dl.sourceforge.net/project/unetbootin/UNetbootin/'
wget -q -O- "$URL" | \
awk -F '"|/' '/^<tr class/ && !/Custom/ {print $4 }' | \
sort -n | tail -1
----------------------------------------------------------------------
--
Privacy Indicator
Unity appindicator to switch privacy settings
<http://www.florian-diesch.de/software/indicator-privacy/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20130525/fcf4aa57/attachment.sig>
More information about the ubuntu-users
mailing list