Tester dans un script un fichier

Fermé
fabouilles Messages postés 6 Date d'inscription jeudi 3 avril 2008 Statut Membre Dernière intervention 31 mars 2010 - 31 mars 2010 à 17:21
dubcek Messages postés 18768 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 29 mars 2025 - 1 avril 2010 à 10:13
Bonjour,


je voudrais savoir si un fichier est présent dans un répertoire .
Si oui, envoyer un mail
voila ,ce que j'ai fait :

if [ -s "/VAR/archives/FICHIER" ]
then
/USR/util/mailx.sh NULL "MOI@moi.fr" " Msg fichier noin present "


Mais lorsque je lance mon script il me dit que :
Syntax error at line 13(ligne du then) : 'then' is not matched

Je suis sous HP-UX
je script sous : sh

Merci de toute aide. . .
A voir également:

2 réponses

kij_82 Messages postés 4089 Date d'inscription jeudi 7 avril 2005 Statut Contributeur Dernière intervention 30 septembre 2013 857
Modifié par kij_82 le 31/03/2010 à 17:54
Bonjour,

Essaie avec un syntaxe plus méticuleuse pour voir:
if [ -s "/VAR/archives/FICHIER" ] ; then  
/USR/util/mailx.sh NULL "MOI@moi.fr" " Msg fichier non present " ;
fi  



~ N'oubliez pas la balise "Résolu" lorsque votre problème est... résolu :) ~
0
dubcek Messages postés 18768 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 29 mars 2025 5 629
1 avril 2010 à 10:13
hello
il manque le fi
if [ -s "/VAR/archives/FICHIER" ]
then
/USR/util/mailx.sh NULL "MOI@moi.fr" " Msg fichier noin present "
fi
0