<appendix id="app3">
<title>Possibilités du Shell</title>

<abstract><para>Ce document donne une vue globale des possibilités courantes d'un Shell et des spécificités possibles.</para></abstract>
<sect1>
<title>Fonctionnalités courantes</title>
<para>

Les fonctionnalités suivantes sont standard dans tout Shell. Notez que 
les commandes stop, suspend, jobs, bg et fg sont disponibles seulement 
sur les systèmes qui permettent le contrôle des travaux (job control).

</para>
<table frame="all">
  <title>Fonctionnalités courantes du Shell</title> 
  <tgroup cols="2" align="left" colsep="1" rowsep="1">
  <thead>
    <row>
      <entry>Commande</entry>
      <entry>sens</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry>&gt;</entry>
      <entry>Redirige la sortie</entry>
    </row>

    <row>
      <entry>&gt;&gt;</entry>
      <entry>Ajoute en fin de fichier</entry>
    </row>
    <row>
      <entry>&lt;</entry>
      <entry>Redirige l'entrée</entry>
    </row>
    <row>
      <entry>&lt;&lt;</entry>
         <entry>Document en ligne (redirige l'entrée)</entry>
</row>
<row>
<entry>|</entry>
         <entry>Sortie par un tube</entry>
</row>
<row>
<entry>&amp;</entry>
         <entry>Place le travail en tâche de fond.</entry>
</row>
<row>
<entry>;</entry>
         <entry>Sépare des commandes sur une même ligne</entry>
</row>
<row>
<entry>*</entry>
        <entry>Correspond à n'importe quel(s) caractère(s) dans un nom de fichier</entry>
</row>
<row>
<entry>?</entry>
        <entry>Correspond à n'importe quel caractère unique dans un nom de fichier</entry>
</row>
<row>
<entry>[ ]</entry>
         <entry>Correspond à n'importe quels caractères inclus</entry>
</row>
<row>
 <entry>( )</entry>
         <entry>S'exécute dans un sous-Shell</entry>
</row>
<row>
<entry>` `</entry>
         <entry>Substitue le contenu par le résultat de la commande incluse</entry>
</row>
<row>
<entry>" "</entry>
         <entry>Guillemets ou citation partielle (permet l'expansion de variables et de commandes)</entry>
</row>
<row>
 <entry>' '</entry>
         <entry>Apostrophes ou citation totale (pas d'expansion)</entry>
</row>
<row>
<entry>\</entry>
         <entry>Citation du caractère qui suit (NdT&nbsp;: emploi du caractère dans son sens littéral-&gt;échappement)</entry>
</row>
<row>
 <entry>$var</entry>
         <entry>Emploie la valeur de la variable</entry>
</row>
<row>
<entry>$$</entry>
         <entry>Identifiant du processus</entry>
</row>
<row>
 <entry>$0</entry>
         <entry>Nom de la Commande</entry>
</row>
<row>
 <entry>$n</entry>
         <entry>Nième argument (N entre 0 et 9)</entry>
</row>
<row>
 <entry><literal>#</literal></entry>
         <entry>Commence un commentaire</entry>
</row>
<row>
 <entry>bg</entry>
         <entry>Exécution en tâche de fond</entry>
</row>
<row>
 <entry>break</entry>
         <entry>Sortir d'une instruction de boucle</entry>
</row>
<row>
 <entry>cd</entry>
         <entry>Change de répertoire</entry>
</row>
<row>
 <entry>continue</entry>
        <entry>Passe à l'itération suivante d'une boucle dans un programme </entry>
</row>
<row>
 <entry>echo</entry>
         <entry>Affiche le résultat</entry>
</row>
<row>
 <entry>eval</entry>
         <entry>Evalue les arguments</entry>
</row>
<row>
<entry>exec</entry>
         <entry>Exécute un nouveau processus Shell</entry>
</row>
<row>
<entry>fg</entry>
         <entry>Exécution dans la session en cours </entry>
</row>
<row>
 <entry>jobs</entry>
         <entry>Affiche les travaux en cours</entry>
</row>
<row>
 <entry>kill</entry>
         <entry>Termine un travail en cours</entry>
</row>
<row>
<entry>newgrp</entry>
         <entry>Change de groupe l'utilisateur</entry>
</row>
<row>
 <entry>shift</entry>
         <entry>Décale les paramètres positionnels</entry>
</row>
<row>
 <entry>stop</entry>
         <entry>Suspend  un travail en tâche de fond</entry>
</row>
<row>
<entry>suspend</entry>
        <entry>Suspend un travail en cours dans la session</entry>
</row>
<row>
 <entry>time</entry>
         <entry>Chronomètre une commande</entry>
</row>
<row> 
<entry>umask</entry>
         <entry>Donne ou liste les permissions sur les fichiers</entry>
</row>
<row> 
<entry>unset</entry>
         <entry>Supprime une variable ou une fonction</entry>
</row>
<row>
 <entry>wait</entry>
         <entry>Attend qu'une tâche de fond se termine</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1><title>Fonctionnalités spécifiques</title>

<para>La table suivante montre les principales différences des Shell courants (<command>sh</command>), Bourne Again SHell (<command>bash</command>), Korn shell (<command>ksh</command>) et le C shell (<command>csh</command>).</para>  
<note><title>Compatibilité des Shell</title>
<para>Parce que Bash est un sur-ensemble de <command>sh</command>, toutes les commandes  <command>sh</command> fonctionnent en <command>Bash</command> - mais pas vice versa.  <command>Bash</command> a bien plus de possibilités qui lui sont propres, et, comme le montre la table suivante, beaucoup de possibilités venant d'autres Shell.</para>
<para>Parce que le Turbo C Shell est un sur-ensemble de <command>csh</command>, toutes les commandes  <command>csh</command> fonctionnent en <command>tcsh</command>, mais l'inverse n'est pas vrai.</para></note>
<table frame="all"><title>Différences de fonctionnalités des Shell</title>
<tgroup cols="5" align="left" colsep="1" rowsep="1">
<thead>
<row>

<entry><command>sh</command></entry><entry><command>Bash</command></entry><entry><command>ksh</command></entry><entry><command>csh</command></entry><entry>Signification/Action</entry>
</row>
</thead>
<tbody>
<row><entry>$</entry><entry>$</entry><entry>$</entry><entry>%</entry><entry>L'invite utilisateur par défaut</entry></row>
<row><entry> </entry><entry><command>&gt;|</command></entry><entry><command>&gt;|</command></entry><entry><command>&gt;!</command></entry><entry>Force la redirection</entry></row>
<row><entry><command>&gt; <filename>fichier</filename> 2&gt;&amp;1</command></entry><entry><command>&amp;&gt; <filename>fichier</filename></command> ou <command>&gt; <filename>fichier</filename> 2&gt;&amp;1</command></entry><entry><command>&gt; <filename>fichier</filename> 2&gt;&amp;1</command></entry><entry><command>&gt;&amp; <filename>fichier</filename></command></entry><entry>Redirige stdout et stderr sur <filename>fichier</filename></entry></row>
<row><entry> </entry><entry><command>{ }</command></entry><entry> </entry><entry><command>{ }</command></entry><entry>Expansion des éléments de la liste</entry></row>
<row><entry><command>`commande`</command></entry><entry><command>`commande`</command> ou <command>$(commande)</command></entry><entry><command>$(commande)</command></entry><entry><command>`commande`</command></entry><entry>Remplace par le résultat de la <command>commande</command> incluse</entry></row>
<row><entry><varname>$HOME</varname></entry><entry><varname>$HOME</varname></entry><entry><varname>$HOME</varname></entry><entry><varname>$home</varname></entry><entry>Répertoire utilisateur</entry></row>
<row><entry> </entry><entry>~</entry><entry>~</entry><entry>~</entry><entry>Symbole équivalent au répertoire utilisateur</entry></row>
<row><entry> </entry><entry><filename>~+</filename>, <filename>~-</filename>, <command>dirs</command></entry><entry><filename>~+</filename>, <filename>~-</filename></entry><entry><filename>=-</filename>, <filename>=N</filename></entry><entry>Accède à la pile des répertoires</entry></row>
<row><entry><command><varname>var</varname>=value</command></entry><entry><command><varname>VAR</varname>=value</command></entry><entry><command><varname>var</varname>=value</command></entry><entry><command>set <varname>var</varname>=value</command></entry><entry>Affectation de variable</entry></row>
<row><entry><command>export <varname>var</varname></command></entry><entry><command>export <varname>VAR</varname>=value</command></entry><entry><command>export <varname>var</varname>=val</command></entry><entry><command>setenv <varname>var</varname> <parameter>val</parameter></command></entry><entry>Publie une variable d'environnement </entry></row>
<row><entry> </entry><entry><varname>${nnnn}</varname></entry><entry><varname>${nn}</varname></entry><entry> </entry><entry>Les paramètres peuvent être référencés au delà des 9 premiers</entry></row>
<row><entry>"<varname>$@</varname>"</entry><entry>"<varname>$@</varname>"</entry><entry>"<varname>$@</varname>"</entry><entry> </entry><entry>Chaque argument est connu comme une valeur indépendante</entry></row>
<row><entry><varname>$#</varname></entry><entry><varname>$#</varname></entry><entry><varname>$#</varname></entry><entry><varname>$#argv</varname></entry><entry>Le nombre d'arguments</entry></row>
<row><entry><varname>$?</varname></entry><entry><varname>$?</varname></entry><entry><varname>$?</varname></entry><entry><varname>$status</varname></entry><entry>Statut d'exécution de la commande la plus récente</entry></row>
<row><entry><varname>$!</varname></entry><entry><varname>$!</varname></entry><entry><varname>$!</varname></entry><entry> </entry><entry>PID de la tâche de fond la plus récente</entry></row>
<row><entry><varname>$-</varname></entry><entry><varname>$-</varname></entry><entry><varname>$-</varname></entry><entry> </entry><entry>Options classiques</entry></row>
<row><entry><command>. <filename>fichier</filename></command></entry><entry><command>source <filename>fichier</filename></command> ou <command>. <filename>fichier</filename></command></entry><entry><command>. <filename>fichier</filename></command></entry><entry><command>source <filename>fichier</filename></command></entry><entry>Lecture de commandes depuis un fichier</entry></row>
<row><entry> </entry><entry><command>alias x='y'</command></entry><entry><command>alias x=y</command></entry><entry><command>alias x y</command></entry><entry>Nom <command>x</command> est équivalent à la commande <command>y</command></entry></row>
<row><entry><command>case</command></entry><entry><command>case</command></entry><entry><command>case</command></entry><entry><command>switch</command> ou <command>case</command></entry><entry>Décline différentes éventualités</entry></row>
<row><entry><command>done</command></entry><entry><command>done</command></entry><entry><command>done</command></entry><entry><command>end</command></entry><entry>Fini une instruction de boucle</entry></row>
<row><entry><command>esac</command></entry><entry><command>esac</command></entry><entry><command>esac</command></entry><entry><command>endsw</command></entry><entry>Marque la fin du <command>case</command> ou du <command>switch</command></entry></row>
<row><entry><command>exit <parameter>n</parameter></command></entry><entry><command>exit <parameter>n</parameter></command></entry><entry><command>exit <parameter>n</parameter></command></entry><entry><command>exit <parameter>(expr)</parameter></command></entry><entry>Quitte avec un statut d'exécution</entry></row>
<row><entry><command>for</command>/<command>do</command></entry><entry><command>for</command>/<command>do</command></entry><entry><command>for</command>/<command>do</command></entry><entry><command>foreach</command></entry><entry>Boucles sur plusieurs variables</entry></row>
<row><entry> </entry><entry><command>set <option>-f</option></command>, <command>set <option>-o nullglob|dotglob|nocaseglob|noglob</option></command></entry><entry> </entry><entry><command>noglob</command></entry><entry>Ignore la substitution de caractères dans la génération de fichier</entry></row>
<row><entry><command>hash</command></entry><entry><command>hash</command></entry><entry><command>alias <option>-t</option></command></entry><entry><command>hashstat</command></entry><entry>Affiche les commandes 'hash' (trace les alias)</entry></row>
<row><entry><command>hash <parameter>cmds</parameter></command></entry><entry><command>hash <parameter>cmds</parameter></command></entry><entry><command>alias <option>-t</option> <parameter>cmds</parameter></command></entry><entry><command>rehash</command></entry><entry>Mémorise où se situe la commande</entry></row>
<row> <entry><command>hash <option>-r</option></command></entry><entry><command>hash <option>-r</option></command></entry><entry> </entry><entry><command>unhash</command></entry><entry>Annule la mémorisation</entry></row>
<row><entry> </entry><entry><command>history</command></entry><entry><command>history</command></entry><entry><command>history</command></entry><entry>Liste les commandes passées</entry></row>
<row><entry> </entry><entry><keycap>ArrowUp</keycap>+<keycap>Enter</keycap> ou <command>!!</command></entry><entry><command>r</command></entry><entry><command>!!</command></entry><entry>Relance la commande précédente</entry></row>
<row><entry> </entry><entry><command>!<parameter>str</parameter></command></entry><entry><command>r <parameter>str</parameter></command></entry><entry><command>!<parameter>str</parameter></command></entry><entry>Relance la commande la plus récemment passée qui commence par <quote>str</quote></entry></row>
<row><entry> </entry><entry><command>!<parameter>cmd</parameter>:s/<parameter>x</parameter>/<parameter>y</parameter>/</command></entry><entry><command>r <parameter>x</parameter>=<parameter>y</parameter> <parameter>cmd</parameter></command></entry><entry><command>!<parameter>cmd</parameter>:s/<parameter>x</parameter>/<parameter>y</parameter>/</command></entry><entry>Remplace <quote>x</quote> par <quote>y</quote> dans la commande la plus récemment passée commençant par <quote>cmd</quote>, puis exécute.</entry></row>
<row><entry><command>if [ <varname>$i</varname> -eq <parameter>5</parameter> ]</command></entry><entry><command>if [ <varname>$i</varname> -eq <parameter>5</parameter> ]</command></entry><entry><command>if ((<varname>i</varname>==<parameter>5</parameter>))</command></entry><entry><command>if (<varname>$i</varname>==<parameter>5</parameter>)</command></entry><entry>Echantillon de tests de conditions</entry></row>
<row><entry><command>fi</command></entry><entry><command>fi</command></entry><entry><command>fi</command></entry><entry><command>endif</command></entry><entry>Marque la fin de l'instruction <command>if</command></entry></row>
<row><entry><command>ulimit</command></entry><entry><command>ulimit</command></entry><entry><command>ulimit</command></entry><entry><command>limit</command></entry><entry>Déclare une limite de ressource</entry></row>
<row><entry><command>pwd</command></entry><entry><command>pwd</command></entry><entry><command>pwd</command></entry><entry><command>dirs</command></entry><entry>Affiche le répertoire courant</entry></row>
<row><entry><command>read</command></entry><entry><command>read</command></entry><entry><command>read</command></entry><entry><command>$&lt;</command></entry><entry>Lecture depuis l'entrée</entry></row>
<row><entry><command>trap <parameter>2</parameter></command></entry><entry><command>trap <parameter>2</parameter></command></entry><entry><command>trap <parameter>2</parameter></command></entry><entry><command>onintr</command></entry><entry>A pour effet d'ignorer les interruptions</entry></row>
<row><entry> </entry><entry><command>unalias</command></entry><entry><command>unalias</command></entry><entry><command>unalias</command></entry><entry>Détruit les alias</entry></row>
<row><entry><command>until</command></entry><entry><command>until</command></entry><entry><command>until</command></entry><entry> </entry><entry>Begin <command>until</command> loop</entry></row>
<row><entry><command>while</command>/<command>do</command></entry><entry><command>while</command>/<command>do</command></entry><entry><command>while</command>/<command>do</command></entry><entry><command>while</command></entry><entry>Begin <command>while</command> loop</entry></row>
</tbody>
</tgroup>
</table>
<para>Bourne Again SHell a bien d'autres possibilités non évoquées ici.  Ce tableau donne un aperçu de comment ce Shell intègre toutes les bonnes idées des autres Shell&nbsp;: il n'y a pas de blanc dans la colonne <command>bash</command>.  Plus d'informations sur les possibilités propres à Bash peuvent être trouvées dans les pages d'info Bash, dans la section <quote>Bash Features</quote>.</para>

<para>Plus d'informations&nbsp;:</para> 
<para>Vous devriez au moins lire un manuel, même si c'est celui de votre Shell.  Le choix pourrait être <command>info bash</command>, <command>bash</command> étant le Shell GNU et le plus facile pour le débutant.  Imprimez-le et emportez-le à la maison, l'étudier dès que vous avez 5 minutes.</para>
</sect1>
</appendix>

Site hébergé sur un Cloud Public IKOULA Ikoula