Created
November 8, 2010 21:27
-
-
Save MichaelMure/668302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CreationBase() { | |
if [ -f "ville" ]; then | |
rm ville | |
fi | |
echo "versaille;786460" >> ville | |
echo "mulhouse;682240" >> ville | |
echo "rouen;765400" >> ville | |
echo "marseille;130550" >> ville | |
echo "lille;593500" >> ville | |
} | |
function AjoutVille() { | |
ligneville=`grep ^"$1" ville` | |
if [[ -z "$ligneville" ]]; then | |
echo "$1;$2" >> ville; | |
else | |
ville=`expr "$ligneville" : '\(.*\);'` | |
code=`expr "$ligneville" : '.*;\(.*\)'` | |
if [[ "$code" != "$2" ]]; then | |
sed -i "s/$1.*/$1;$2/" ville | |
fi | |
fi | |
} | |
function RetireCle() { | |
sed -i "/$1/d" ville | |
} | |
function DlVille() { | |
ligne=`grep -i "$1" ville` | |
code=`expr "$ligne" : '.*;\(.*\)'` | |
if [[ ! -z $code ]]; then | |
curl -s -o $code "http://france.meteofrance.com/france/meteo?PREVISIONS_PORTLET.path=previsionsville/$code" | |
fi | |
} | |
function Process() { | |
$ligne=`grep '<div id="prev_locales">' 786460` | |
} | |
function Antidate() { | |
echo "non implementé" | |
} | |
function GenereVille() { | |
echo "non implementé" | |
} | |
function GenereDate() { | |
echo "non implementé" | |
} | |
while [ $# != 0 ]; do | |
case "$1" in | |
-c) CreationBase;; | |
-a) AjoutVille $2 $3; shift 2;; | |
-r) RetireCle $2; shift;; | |
-g) DlVille $2; shift;; | |
-p) Process;; | |
-f) Antidate;; | |
-t) GenereVille $2; shift;; | |
-d) GenereDate $2; shift;; | |
*) echo "Fonction non reconnu: $1";; | |
esac | |
shift | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment