Script shell

Exemple de script shell.

Un script shell est un programme informatique développé pour fonctionner dans un interpréteur de commandes shell Unix[1]. Il utilise des commandes de terminal comme code. Un shell script est un fichier finissant avec l'extension .sh.

Le terme est aussi utilisé de façon plus large pour désigner l'utilisation automatisée d'une interface système (shell) ; chaque système d'exploitation utilise une dénomination particulière pour ces fonctions notamment batch files (pour MS-DOS-Win95, OS/2), procedure commands (VMS) et scripts shell.

Les shells les plus courants pour les systèmes Unix ou type Unix sont le Korn shell (ksh), le Bourne shell (bsh) et Bourne-Again shell (bash). Même pour des systèmes ayant un shell différent, tel que Zsh sur macOS, ces shells sont présents pour assurer la rétro-compatibilité[2].

Histoire

Le shell script a été créé en même temps que l'Interpréteur de commandes BSH en 1977. Il était conçu pour exécuter plusieurs commandes plus rapidement et simplement.

Exemple

echo "Hello World"
read -p "Quel est votre nom ?" name
echo "Votre nom est $name"

Notes et références

  1. Brian W. Kernighan et Rob Pike, The UNIX Programming Environment, Prentice Hall, Inc., (ISBN 0-13-937699-2), « 3. Using the Shell », p. 94 :

    « The shell is actually a programming language: it has variables, loops, decision-making, and so on. »

  2. Arnold Robbins and Nelson H.F. Beebe, Classic Shell Scripting, O'Reilly Media, (ISBN 978-0-596-00595-5), p. 5

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.