Attachment 'riesenie.sh.html'

Download

#!/usr/bin/env bash
export LC_ALL=C

# do premennej SITE ulozime iba server
SITE=`echo $1 | sed 's@\(http://[^/]*\).*@\1@'`

# ak neexistuje adresar img, vytvorime ho
# budeme donho ukladat obrazky
if ! -d img
then
        mkdir img
fi

# prechadzame vsetky URL na schranke
for RURL in `
wget -O - -q $1 | 
        tr -d '\n' | 
        sed 's/>/>\n/g' |
        grep '< *[iI][mM][gG].*[sS][rR][cC]'|
        sed 's/.*</</' |
        sed "s/.*[iI][mM][gG].*[sS][rR][cC] *= *[\"']\?//" |
        sed "s/[ \"'].*//"`
do
        URL=$RURL
        
        # vytvorime uplne URL pre wget
        # musime rozlisit typy ^http://, ^/ a ostatne
        if test -z `echo $RURL | grep '^http://'` 
        then
          if test -z `echo $RURL | grep '^/'`
          then
                URL=${1}${RURL}
          else
                URL=${SITE}${RURL}
          fi
        fi    
        
        # meno suboru je to, co je za poslednym lomitkom v URL
        FNM=`echo $URL | sed 's@.*/@@'`

        # niektore stranky obsahuju viacej razy ten isty obrazok
        # vtedy ho nestahujeme viac razy, je to zbytocne
        # testujeme tu, ci subor uz existuje
        if test ! -f img/$FNM
        then 
                echo $URL
                wget -O img/$FNM -q $URL
        fi
done


Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-04-29 11:32:08, 1.0 KB) [[attachment:riesenie.sh]]
  • [get | view] (2009-04-29 11:30:23, 8.3 KB) [[attachment:riesenie.sh.html]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.