• [^] # Re: standard ? - en cherchant un peu:

    Posté par . En réponse au message fonction en bourne shell. Évalué à 2.

    Tu vas voitr ici: http://www.rz.uni-hohenheim.de/betriebssysteme/unix/aix/aix_4.3.3_d(...)
    Tu y trouve ce qui est commun au Korn Shell et aux shelmls posix, plus les extensions propres a ksh. En theorie, si tu developpes en suivant ce qui est inddiqué pour les shells posix, ca devrait fonctionner pour tout shell se prétendant posix (je dis bien devrait car ilm me semble que parfois il y a des petites incompatibilités, faire une recherche sur fr.comp.os.unix, le sujet y est abordé de temps en temps).

    Par exemple les 'builtin command':
    http://www.rz.uni-hohenheim.de/betriebssysteme/unix/aix/aix_4.3.3_d(...)


    Korn Shell or POSIX Shell Built-In Commands
    Special commands are built in to the Korn shell and POSIX shell and executed in the shell process. Unless otherwise indicated, the output is written to file descriptor 1 and the exit status is 0 (zero) if the command does not contain any syntax errors. Input and output redirection is permitted. There are two types of built-in commands, special built-in commands and regular built-in commands.

    Refer to the List of Korn Shell or POSIX Shell Built-in Commands for an alphabetical listing of these commands.

    Special built-in commands differ from regular built-in commands in the following ways:

    A syntax error in a special built-in command may cause the shell executing the command to end. This does not happen if you have a syntax error in a regular built-in command. If a syntax error in a special built-in command does not end the shell program, the exit value is non-zero.
    Variable assignments specified with special built-in commands remain in effect after the command completes. This is not the situation with regular built-in commands.
    I/O redirections are processed after parameter assignments.
    In addition, words that are in the form of a parameter assignment following the export, readonly, and typeset special commands are expanded with the same rules as a parameter assignment. This means that tilde substitution is performed after the = (equal sign), and word splitting and file name substitution are not performed.

    Special Built-in Command Descriptions
    The Korn Shell provides the following special built-in commands:

    : eval newgrp shift
    . exec readonly times
    break exit return trap
    continue export set typeset
    unset

    Chaque commande posix y est détaillée, je te laisse y jeter un oeil ....

    Attention, ce n'est pas parce que tu écriras tes scripts en suivant la norme posix que ca fonctionnera partout. Il ne faut pas oublier que le shell est un outil qui appelle d'autres commandes, et selon les systèmes il existe des variantes pour ces commandes (par ex, les outils GNU implémentent des extensions que les autres outils UNIX n'implémentent pas).