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

  FORUM HardWare.fr
  Linux et OS Alternatifs
  Codes et scripts

  [Shell] C'est quoi la syntaxe du switch (case) :??:

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Shell] C'est quoi la syntaxe du switch (case) :??:

n°268766
the mystic​al
It’s a competitive world...
Posté le 27-05-2003 à 19:46:19  profilanswer
 

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  :jap:


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...
mood
Publicité
Posté le 27-05-2003 à 19:46:19  profilanswer
 

n°268833
bobuse
Posté le 27-05-2003 à 21:42:50  profilanswer
 
n°268848
the mystic​al
It’s a competitive world...
Posté le 27-05-2003 à 22:25:37  profilanswer
 


 
j'ai lu pas mal de doc mais y'en a aucune qui m'a donné satisfaction :/


---------------
It's hard to say it, I hate to say it, but it's probably me...
n°268908
chouki
Posté le 27-05-2003 à 23:55:53  profilanswer
 

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

n°268923
the mystic​al
It’s a competitive world...
Posté le 28-05-2003 à 00:34:15  profilanswer
 

Parfait!
 
Thanx ! :jap:  
 


---------------
It's hard to say it, I hate to say it, but it's probably me...
n°269002
bobuse
Posté le 28-05-2003 à 10:21:44  profilanswer
 

The Mystical a écrit :


 
j'ai lu pas mal de doc mais y'en a aucune qui m'a donné satisfaction :/


 :heink:  
 
 

Citation :

echo -n "Enter the name of an animal: "
read ANIMAL
echo -n "The $ANIMAL has "
case $ANIMAL in
  horse | dog | cat) echo -n "four";;
  man | kangaroo ) echo -n "two";;
  *) echo -n "an unknown number of";;
esac
echo " legs."


---------------
get amaroK plugin
n°269046
philou_a7
\_o< coin ! >o_/
Posté le 28-05-2003 à 11:08:22  profilanswer
 

man bash :kaola:


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Linux et OS Alternatifs
  Codes et scripts

  [Shell] C'est quoi la syntaxe du switch (case) :??:

 

Sujets relatifs
Fenêtre shell tjrs ouverte et "incrustée" au fond d'écran ?petite question sur les users et leur shell ;)
Besoin d'aide pour un script shell (avec awk)lancer une appli graphique a partir d un shell
[shell] lister les fichiers d'un rep et sub-rep par ordre de datesyntaxe ioctl
Comment créer un tube nommé sous Linux avec le shell bash ?Changer de Shell
[shell box] bsd, nux, hurd .. autre ?switch écran / perte de souris
Plus de sujets relatifs à : [Shell] C'est quoi la syntaxe du switch (case) :??:


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