Section courante

A propos

Section administrative du site

 Langage  Elément  Programmation  Aide 
ABAP/4
Ada
Assembleur
Assembly & bytecode
ASP (Active Server Pages)
Basic
C
C++
C# (C Sharp)
Cobol
ColdFusion
Fortran
HTML
Java
JavaScript
LISP
Logo
LotusScript
Oberon
Pascal
Perl
PHP
PL/1
Prolog
Python
Rebol
REXX
Ruby
SAS
NoSQL
SQL
Swift
X++ (Axapta)
GNAT
SMALLAda
VHDL
Assembleur 370
Assembleur 1802
Assembleur 4004
Assembleur 6502
Assembleur 6800
Assembleur 68000
Assembleur 8080 et 8085
Assembleur 8089
Assembleur 80x86
Assembleur AGC4
Assembleur ARM
Assembleur DPS 8000
Assembleur i860
Assembleur Itanium
Assembleur MIPS
Assembleur PDP-11
Assembleur PowerPC
Assembleur RISC-V
Assembleur SPARC
Assembleur SuperH
Assembleur UNIVAC I
Assembleur VAX
Assembleur Z80
Assembleur Z8000
Assembleur z/Architecture
ASSEMBLER/MONITOR 64
Micol Assembler
GFA Assembler
A86
MASM (Macro Assembler)
TASM (Turbo Assembler)
CIL
Jasmin
LLVM
MSIL
Parrot
P-Code (PCode)
SWEET16
G-Pascal
ASP 1.0
ASP 2.0
ASP 3.0
ASP.NET
ASP.NET Core
ABasiC (Amiga)
Adam SmartBASIC
Altair BASIC
AmigaBASIC (Amiga)
AMOS Basic (Amiga)
Atari Basic (Atari 400, 600 XL, 800, 800XL)
Basic Apple II (Integer BASIC/APPLESOFT)
Basic Commodore 64 (CBM-BASIC)
Basic Commodore 128 (BASIC 7.0)
Basic Commodore VIC-20 (CBM-BASIC 2.0)
Basic Coco 1 (Color Basic)
Basic Coco 2 (Extended Color Basic)
Basic Coco 3 (Extended Color Basic 2.0)
BASICA (PC DOS)
Basic Pro
BBC BASIC
Blitz BASIC (Amiga)
DarkBASIC
Dartmouth BASIC
GFA-Basic (Atari ST/Amiga)
GWBASIC (MS-DOS)
Liberty BASIC
Locomotive BASIC (Amstrad CPC)
MSX-Basic
Omikron Basic (Atari ST)
Oric Extended Basic
Power Basic
Quick Basic/QBasic (MS-DOS)
Sinclair BASIC (ZX80, ZX81, ZX Spectrum)
ST BASIC (Atari ST)
Turbo Basic
Vintage BASIC
VBScript
Visual Basic (VB)
Visual Basic .NET (VB .NET)
Visual Basic pour DOS
Yabasic
BeckerBASIC
SIMONS' BASIC
Basic09 d'OS-9
Disk Extended Color Basic
Basic09 d'OS-9
Disk Extended Color Basic
Access
Excel
Visual Basic pour Windows
Visual Basic .NET pour Windows
C Shell Unix (csh)
C pour Amiga
C pour Atari ST
C pour DOS
C pour Falcon030
C pour GEMDOS (Atari ST)
C pour Linux
C pour PowerTV OS
C pour OS/2
C pour Unix
C pour Windows
Aztec C
CoCo-C
GNU C
HiSoft C
IBM C/2
Introl-C
Lattice C
Microsoft C
MinGW C
MSX-C
Open Watcom C
OS-9 C Compiler
Pure C
Quick C
Turbo C
HiSoft C for Atari ST
HiSoft C for CP/M (Amstrad CPC)
C++ pour OS/2
C++ pour Windows
Borland C++
C++Builder
IBM VisualAge C++
Intel C++
MinGW C++
Open Watcom C++
Symantec C++
Turbo C++
Visual C++
Visual C++ .NET
Watcom C++
Zortech C++
C# (C Sharp) pour Windows
Apple III Cobol
Microsoft Cobol
BlueDragon
Lucee
OpenBD
Railo
Smith Project
Microsoft Fortran
WATFOR-77
CSS
FBML
Open Graph
SVG
XML
XSL/XSLT
LESS
SASS
GCJ (GNU)
JSP
Jython
Visual J++
Node.js
TypeScript
AutoLISP
ACSLogo
LotusScript pour Windows
Amiga Oberon
Oberon .NET
Apple Pascal
Delphi/Kylix/Lazarus
Free Pascal
GNU Pascal
HighSpeed Pascal
IBM Personal Computer Pascal
Lisa Pascal
Maxon Pascal
MPW Pascal
OS-9 Pascal
OSS Personal Pascal
Pascal-86
Pascal du Cray Research
Pascal/VS
Pascal-XT
PURE Pascal
QuickPascal
RemObjets Chrome
Sun Pascal
THINK Pascal
Tiny Pascal (TRS-80)
Turbo Pascal
UCSD Pascal
VAX Pascal
Virtual Pascal
Turbo Pascal for CP/M-80
Turbo Pascal for DOS
Turbo Pascal for Macintosh
Turbo Pascal for Windows
CodeIgniter (Cadre d'application)
Drupal (Projet)
Joomla! (Projet)
Phalanger (PHP .NET)
phpBB (Projet)
Smarty (balise)
Twig (balise)
Symfony (Cadre d'application)
WordPress (Projet)
Zend (Cadre d'application)
PL360
PL/M-80
PL/M-86
Turbo Prolog
CPython
IronPython
Jython
PyPy
AREXX
Regina REXX
JMP
Btrieve
Cassandra
Clipper
CouchDB
dBASE
Hbase
Hypertable
MongoDB
Redis
Access
BigQuery
DB2
H2
Interbase
MySQL
Oracle
PostgreSQL
SAP HANA
SQL Server
Sybase
U-SQL
Remarques
Conditionnel
Boucle
Bonjour
Exemple de Menu
Préface
Notes légal
Dictionnaire
Recherche

Voici un exemple de menu pour la console écrit en C Shell pour Linux lorsque j'étais au CÉGEP :

  1. #!/bin/csh
  2.  
  3. # ****************************************************************************
  4. # * *
  5. # * P R O J E T 1 - Shell par Menu *
  6. # * *
  7. # * Nom du programmeur: Sylvain Maltais *
  8. # * Date de creation: 1998/10/08 *
  9. # * *
  10. # * Description *
  11. # * ----------- *
  12. # * *
  13. # * Ce projet permet de manipuler les fonctions elementaires du shell Unix *
  14. # * sous forme d'un menu a numero. Il suffit d'entrer un numero pour par *
  15. # * effectuer une demande de changement de repertoire par exemple. *
  16. # * *
  17. # * Syntaxe *
  18. # * menu (aucun parametre requis) *
  19. # * *
  20. # ****************************************************************************
  21.  
  22. # Fichier temporaire: temp
  23. # Fichier auxiliaire: sub et read
  24. # Variable temporaire: temp, ok
  25.  
  26. set temp = `pwd` 
  27. set ok = Oui
  28.  
  29. # extra ----
  30.  
  31. clear
  32. echo "******************************************************************"
  33. echo "* *"
  34. echo "* Projet 1 - Tous droits reserves par Gladir.com *"
  35. echo "* *"
  36. echo "* Octobre 1998 *" 
  37. echo "* *"
  38. echo "* Programme fait par Sylvain Maltais *"
  39. echo "* *"
  40. echo "* Description *"
  41. echo "* ----------- *"
  42. echo "* *"
  43. echo "* Programme de gestion du Shell Unix par Menu deroulant. *"
  44. echo "* *"
  45. echo "******************************************************************"
  46. echo ""
  47. echo "Appuyer sur ENTER touche pour continuer"
  48. ~/projet1/read
  49.  
  50. while ( $ok == Oui )
  51.    clear
  52.    echo "Repertoire courant: `pwd`"
  53.    echo "(repertoire memorise: $temp)" 
  54.    echo ""
  55.    echo " Menu principal:"
  56.    echo ""
  57.    echo " 1 - Retourner au repertoire parent"
  58.    echo " 2 - Aller a un repertoire enfant"
  59.    echo " 3 - Lister le contenu du repertoire courant"
  60.    echo " 4 - Montrer l'aborescence de repertoire a partir du repertoire courant"
  61.    echo " 5 - Memoriser le repertoire courant"
  62.    echo " 6 - Memoriser le repertoire courant et aller au repertoire memorise"
  63.    echo " 7 - Afficher le contenu d'un fichier (page par page, lignes numerotes)"
  64.    echo " 8 - Executer une commande UNIX du shell"
  65.    echo " 9 - Renommer un fichier"
  66.    echo ""
  67.    echo " 0 - Quitter"
  68.    echo ""
  69.    echo "Votre choix?"
  70.    set choix = `~/projet1/read`
  71.    switch ( $choix )
  72.       case 1:
  73.          cd ..
  74.       breaksw
  75.       case 2:
  76.          clear
  77.          echo "A quel repertoire voulez-vous acceder?"
  78.          echo ""
  79.          set dir=`ls`
  80.          touch ~/projet1/temp
  81.          set n = 1
  82.          foreach x ( $dir )
  83.             if ( -d $x ) then
  84.                echo $x >> ~/projet1/temp
  85.                echo $n - $x
  86.                @ n++
  87.             endif
  88.          end
  89.          echo ""
  90.          echo "0 - Annuler la commande"
  91.          echo ""
  92.          echo "Votre choix?"
  93.          set a=`~/projet1/read`
  94.          if ( $a != 0 ) then
  95.             set repchoix=`head -$a ~/projet1/temp | tail -1`
  96.             cd $repchoix
  97.          endif
  98.          rm ~/projet1/temp
  99.       breaksw
  100.       case 3:
  101.          clear
  102.          set nf=0
  103.          set nr=0
  104.          set nl=`ls | wc -l`
  105.          echo "Le contenu de `pwd` est: "
  106.          @ n = 1
  107.          while ( $n <= $nl ) 
  108.             @ n++
  109.             set x = `ls -l -p | head -$n | tail -1`
  110.             if ( -d $x[9] ) then
  111.                @ nr++
  112.                echo $x[9] #>> ~/projet1/temp
  113.             else
  114.                @ nf++
  115.                echo $x[9] ":" $x[5] "octet(s)"
  116.             endif
  117.          end
  118.          echo ""
  119.          echo $nr "repertoire," $nf "fichier(s) normal(aux)"
  120.          echo ""
  121.          echo "Appuyer sur ENTER pour continuer"
  122.          ~/projet1/read
  123.       breaksw
  124.       case 4:
  125.          clear
  126.          set rep=`pwd`
  127.          echo $rep
  128.          echo ""
  129.          ~/projet1/sub $rep"/" 1
  130.          echo ""
  131.          echo "Appuyer sur ENTER pour continuer"
  132.          ~/projet1/read 
  133.       breaksw
  134.       case 5:
  135.          clear
  136.          echo "Entrez le repertoire a memoriser"
  137.          set temp=`~/projet1/read` 
  138.       breaksw
  139.       case 6:
  140.          clear
  141.          set x=$temp
  142.          set temp=`pwd`
  143.          cd x
  144.          echo "Repertoire inversee"
  145.          echo "Entrez une touche pour continuer"
  146.          ~/projet1/read
  147.       breaksw
  148.       case 7:
  149.          clear
  150.          echo "A quel fichier voulez-vous acceder?"
  151.          echo ""
  152.          set dir=`ls`
  153.          touch ~/projet1/temp
  154.          set n = 1
  155.          foreach x ( $dir )
  156.             if ( -d $x ) then
  157.             else
  158.                echo $x >> ~/projet1/temp
  159.                echo $n - $x
  160.                @ n++
  161.             endif
  162.          end
  163.          echo ""
  164.          echo "0 - Annuler la commande"
  165.          echo ""
  166.          echo "Votre choix?"
  167.          set a=`~/projet1/read`
  168.          if ( $a != 0 ) then
  169.             set repchoix=`head -$a ~/projet1/temp | tail -1`
  170.             echo "Le contenu de: "$repchoix
  171.             nl $repchoix | more
  172.             echo "Appuyer sur ENTER pour continuer"
  173.             ~/projet1/read
  174.          endif
  175.          rm ~/projet1/temp
  176.       breaksw
  177.       case 8:
  178.          clear
  179.          echo "Entrez votre commande:"
  180.          set a=`~/projet1/read`
  181.          $a
  182.          echo "Appuyer sur ENTER pour continuer"
  183.          ~/projet1/read
  184.       breaksw
  185.       case 9:
  186.          clear
  187.          echo "Quel est le fichier a renommer"
  188.          echo ""
  189.          set dir=`ls`
  190.          touch ~/projet1/temp
  191.          set n=1
  192.          foreach x ( $dir )
  193.             if ( -d $x ) then
  194.             else
  195.                echo $x >> ~/projet1/temp
  196.                echo $n - $x
  197.                @ n++
  198.             endif
  199.          end
  200.          echo ""
  201.          echo "0 - Annuler la commande"
  202.          echo ""
  203.          echo "Votre choix?"
  204.          set a=`~/projet1/read`
  205.          if ( a$ != 0 ) then
  206.             set rep=`head -$a ~/projet1/temp | tail -1`
  207.             echo "Entrez votre nouveau nom?"
  208.             set b=`~/projet1/read`
  209.             mv $rep $b
  210.             echo "Renomme "$rep" a "$b
  211.             echo "Presse ENTER pour continuer"
  212.             ~/projet1/read
  213.          endif
  214.          rm ~/projet1/temp
  215.       breaksw
  216.       case 0:
  217.          set ok = Non
  218.       breaksw
  219.    endsw
  220. end


PARTAGER CETTE PAGE SUR
Dernière mise à jour : Lundi, le 8 octobre 2018