Bon, reprenons
#!/bin/bash
#xplanet-gnome.sh shell script v0.2
#shows Earth on your Gnome desktop with current lighting conditions,i.e. day and night
blabla commentaires, ok
GEOMETRY=1024x768
LONGITUDE=-180
LATITUDE=-17
#default is no projection,i.e. render a globe
#rectangular is the flat world map. also try ancient, azimuthal, mercator,..
#PROJECTION=rectangular
tout ca, ok
#début de la boucle
until $LONGITUDE=180
do
ca non. c'est du bash...
#début de la boucle
until [ $LONGITUDE -eq 180 ]
do
PREFIX=/home/tama/Background/xplanet/
OUTPUT=xplanet.png
APPEND=2
#rename background image so Gnome realises image has changed - thx to dmbasso
if [ -e "$PREFIX$OUTPUT" ]; then
rm "$PREFIX$OUTPUT"
OUTPUT="$APPEND$OUTPUT"
else
rm "$PREFIX$APPEND$OUTPUT"
fi
ca c'est le code de xplanet que je reconnais. Je suis pas fan du fichier temporaire dans le home, ou alors dans le home/tmp... mais bon, ca te regarde.
if [ -z $PROJECTION ]; then
xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -gmtlabel -config xplanet.conf
else
xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -projection $PROJECTION -gmtlabel -config xplanet.conf
fi
plusieurs points:
1) si tu veux faire tourner une planete, ne laisse que le premier cas du if, ca sera plus lisible
2) mettre -config xplanet.conf me parait une mauvaise idee. Il faut au moins un chemin absolu, ou mettre un cd au debut de ton script. Je te conseille tout simplement d'utiliser le fichier par defaut...
#update Gnome backgound
gconftool -t str -s /home/tama/Background/xplanet/background_filename "$OUTPUT"
Bon, la, tu as modifie cette ligne, et c'etait la mauvaise idee. Cette ligne ecrit dans le "registre" de Gnome. Le -s donne l'adresse de la cle. Il faut que tu laisses/desktop/gnome/background/picture_filename sinon, tu ecris n'importe ou.
#incrémentation de 1 pour la longitude
LONGITUDE=$(($LONGITUDE+10))
mmm 1 ou 10 ?
exec sh /home/tama/xplanet-gnome
est avantageusement remplace par
exec /home/tama/xplanet-gnome
ou
exec bash /home/tama/xplanet-gnome
si tu ne veux pas rendre ton fichier executable.
Au final, ca te donne un fichier du genre :
#!/bin/bash
#xplanet-gnome.sh shell script v0.2
#shows Earth on your Gnome desktop with current lighting conditions,i.e. day and night
DELAY=10s
GEOMETRY=1024x768
LONGITUDE=-180
LATITUDE=-17
#default is no projection,i.e. render a globe
#rectangular is the flat world map. also try ancient, azimuthal, mercator,..
#PROJECTION=rectangular
#début de la boucle
until [ $LONGITUDE -eq 180 ]
do
PREFIX=/home/tama/tmp/
OUTPUT=xplanet.png
APPEND=2
#rename background image so Gnome realises image has changed - thx to dmbasso
if [ -e "$PREFIX$OUTPUT" ]; then
rm "$PREFIX$OUTPUT"
OUTPUT="$APPEND$OUTPUT"
else
rm "$PREFIX$APPEND$OUTPUT"
fi
xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -gmtlabel
#update Gnome backgound
gconftool -t str -s /desktop/gnome/background/picture_filename "$PREFIX$OUTPUT"
#incrémentation de 10 pour la longitude
LONGITUDE=$(($LONGITUDE+10))
sleep $DELAY
done
exec $0