Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1160 connectés 

  FORUM HardWare.fr
  Programmation
  Shell/Batch

  [Résolu] Unexpected end of file

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Résolu] Unexpected end of file

n°1680909
Gavrinis
Open your mind
Posté le 02-02-2008 à 17:31:44  profilanswer
 

Bonjour,
 
Je suis en train d'écrire un script de backup mais celui-ci me retourne toujours la même erreur au lancement, à savoir "./back.sh: line 55: syntax error: unexpected end of file"
 
Voici mon code :

Code :
  1. #!/bin/sh
  2. # Définition des variables.
  3. backup="/home/gavrinis/backup"
  4. backup3000="/home/gavrinis/backup/backup-3000"
  5. poutlook="/media/Backup-Outlook"
  6. outlook="/home/gavrinis/backup/backup-3000/Backup-Outlook"
  7. pfirefox1="/media/Profil-Firefox-1"
  8. firefox1="/home/gavrinis/backup/backup-3000/Profil-Firefox/App-data"
  9. pfirefox2="/media/Profil-Firefox-2"
  10. firefox2="/home/gavrinis/backup/backup-3000/Profil-Firefox/Local-set"
  11. ############################################################################
  12. # On vérifie si le PC est allumé.
  13. ping 10.1.1.2 -c5 -q
  14. if [ $? == 1 ]; then
  15. # On l'allume.
  16. wakeonlan 00:13:8F:3A:0A:F3
  17. # On attend 60 secondes (le temps qu'il démarre)
  18. sleep 60
  19. fi
  20. # Création des répertoires de backup et backup-3000 si ils n'existent pas.
  21. if [ ! -d $backup ]; then mkdir -v /home/gavrinis/backup/ fi
  22. if [ ! -d $backup3000 ]; then mkdir -v /home/gavrinis/backup/backup-3000/ fi
  23. # Sauvegarde des mails Outlook.
  24. if [ ! -d $poutlook ]; then mkdir -v /media/Backup-Outlook/ fi
  25. smbmount //10.1.1.2/Backup-Outlook/ /media/Backup-Outlook/
  26. if [ ! -d $outlook ]; then mkdir -v /home/gavrinis/backup/backup-3000/Backup-Outlook/ fi
  27. cp -R -uv /media/Backup-Outlook/ /home/gavrinis/backup/backup-3000/Backup-Outlook/
  28. echo "C:\Documents and Settings\Gavrinis\Local Settings\Application Data\Microsoft\Outlook\ " > /home/gavrinis/backup/backup-3000/Backup-Outlook/chemin-Windows.txt
  29. umount /media/Backup-Outlook/
  30. # Sauvegarde du profil Firefox 1.
  31. if [ ! -d $pfirefox1 ]; then mkdir -v /media/Profil-Firefox-1/ fi
  32. smbmount //10.1.1.2/Profil-Firefox-1/ /media/Profil-Firefox-1/
  33. if [ ! -d $firefox1 ]; then mkdir -v /home/gavrinis/backup/backup-3000/Profil-Firefox/App-data/ fi
  34. cp -R -uv /media/Profil-Firefox-1/ /home/gavrinis/backup/backup-3000/Profil-Firefox/App-data/
  35. echo "C:\Documents and Settings\Gavrinis\Application Data\Mozilla\ " > /home/gavrinis/backup/backup-3000/Profil-Firefox/App-data/chemin-Windows.txt
  36. umount /media/Profil-Firefox-1/
  37. # Sauvegarde du profil Firefox 2.
  38. if [ ! -d $pfirefox2 ]; then mkdir -v /media/Profil-Firefox-2/ fi
  39. smbmount //10.1.1.2/Profil-Firefox-2/ /media/Profil-Firefox-2/
  40. if [ ! -d $firefox2 ]; then mkdir -v /home/gavrinis/backup/backup-3000/Profil-Firefox/Local-set/ fi
  41. cp -R -uv /media/Profil-Firefox-2/ /home/gavrinis/backup/backup-3000/Profil-Firefox/Local-set/
  42. echo "C:\Documents and Settings\Gavrinis\Local Settings\Application Data\Mozilla\Firefox\Profiles\ " > /home/gavrinis/backup/backup-3000/Profil-Firefox/Local-set/chemin-Windows.txt
  43. umount /media/Profil-Firefox-2/


Merci d'avance pour votre aide précieuse :jap:


Message édité par Gavrinis le 03-02-2008 à 11:57:10
mood
Publicité
Posté le 02-02-2008 à 17:31:44  profilanswer
 

n°1681000
Gavrinis
Open your mind
Posté le 03-02-2008 à 00:02:31  profilanswer
 

s'il vous plait ... tout ce que je demande c'est un peu d'aide :(

n°1681013
Profil sup​primé
Posté le 03-02-2008 à 06:05:38  answer
 

Il manquerait pas des ';' après les then .... ;

n°1681016
olivthill
Posté le 03-02-2008 à 08:54:38  profilanswer
 

Oui, il faut un point virgule avant un "fi" qui n'est pas seul sur une ligne.  
Par exemple, il en faut aux lignes 26 et 27, mais c'est inutile à la ligne 22, car le retour à la ligne permet la séparation. Sinon, l'interpreteur de commande croit que le "mkdir" de la ligne 26 prend "fi" comme deuxième paramètre, et il ne voit pas le "fi" correspondant au "if".

n°1681037
Gavrinis
Open your mind
Posté le 03-02-2008 à 11:56:56  profilanswer
 

merci beaucoup c'était bien ça :)


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Shell/Batch

  [Résolu] Unexpected end of file

 

Sujets relatifs
[Résolu] Remplacer des caractères par d'autres dans un fichier texte[RESOLU]decoupe d'images via le net
[RESOLU] Excel Macro : Sheet-Range.select avec ActiveX[résolu] Problème d'affichage sous IE avec librairie mootools
[Résolu] WebService et caractère €[Résolu] Connexion php sur base sql server 2005
[Resolu] Compter nombre de page dans un book[Résolu] Mail ecrit en chinois illisible envoye via un formulaire
erreur : failed to open stream: No such file or directory ....Classement suivant un total calculé
Plus de sujets relatifs à : [Résolu] Unexpected end of file


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR