bonjour je viens du monde du windows, je débute le shell
j'ai eu de la misère a résoudre ce petit problème, programme doit chercher si un fichier existe puis il récupère le nom du l'image du fichier pour la pouvoir effacer voici mon bout de code ca marche pas je sais pas ou je me suis tromper, merci pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #!/bin/bash exist=`ls -l | grep 'suppr.txt' | wc -l` if [ $exist -eq 1 ] then read ligne<suppr.txt nom=`echo $ligne | cut -f 1 -d :` image=`echo $ligne | cut -f 2 -d :` if [ -n "$image" ] then cd /home/images read ligne<suppr.txt image=`echo $ligne | cut -f 2 -d :` existimage=`ls -l | grep $image | wc -l` if [ $existimage -eq 1 ] then sudo chmod 777 $image sudo chown root $image sudo chgrp root $image sudo rm -Rf /home/images/'$image' fi fi fi
Partager