C'est quoi la syntaxe du switch (case) :??: [Shell] - Codes et scripts - Linux et OS Alternatifs
Marsh Posté le 27-05-2003 à 21:42:50
ReplyMarsh Posté le 27-05-2003 à 22:25:37
 
 
j'ai lu pas mal de doc mais y'en a aucune qui m'a donné satisfaction 
Marsh Posté le 27-05-2003 à 23:55:53
exemple: 
 
case $choice in 
1) 
echo " Quelle extension? (ex. mp3 avi jpg *)" 
read ext 
rta `pwd` \*.$ext :l -s 
echo "" 
echo "Aussi les répertoires et sous-rép. ? (o/n)" 
read rep 
if test $rep == 'o' 
then  
rta `pwd` \* :l -d -s 
fi 
;; 
 
2) 
echo " Quelle extension? (*) pour tout" 
read ext 
rta `pwd` \*.$ext :u -s 
echo "" 
echo "Aussi les répertoires et sous-rép. ? (o/n)" 
read rep 
if test $rep == 'o' 
then 
rta `pwd` \* :u -d -s 
fi 
;; 
 
3) 
echo "Fichiers ou Répertoires? (f/r)" 
read fr 
echo "Remplacer par quel quel caractere?" 
read char 
if test $fr == 'r' 
then rta `pwd` \* -src: " ": $char:r -s -d 
else rta `pwd` \* -src: " ": $char:r -s 
fi 
 
;; 
esac
Marsh Posté le 28-05-2003 à 00:34:15
Parfait! 
 
Thanx !  
  
 
Marsh Posté le 28-05-2003 à 10:21:44
| The Mystical a écrit :   | 
 
  
  
 
 
| Citation : echo -n "Enter the name of an animal: "  | 
Marsh Posté le 27-05-2003 à 19:46:19
j'ai fait ça mais apparemment c pas bon
echo "********************************"
echo "* (1) Creation *"
echo "* (2) Suppression *"
echo "********************************"
echo
echo "Votre choix : "
read choice
switch ($choice)
case 1:
echo "ça marche"
breaksw
case 2:
echo "ça marche pas"
breaksw
endsw
c koi la syntaxe exacte ??
Merci
Message édité par the mystical le 27-05-2003 à 19:46:38
---------------
It's hard to say it, I hate to say it, but it's probably me...