Hotfix release available: 2025-05-14b "Librarian".
upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian".
upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian".
upgrade now! [56] (what's this?)
Hotfix release available: 2024-02-06b "Kaos".
upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos".
upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos".
upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum".
upgrade now! [54.2] (what's this?)
bash
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| bash [2024/02/12 14:57] – created 195.221.243.132 | bash [2024/02/12 15:28] (current) – 195.221.243.132 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | </ | ||
| Stocker le résultat d'une commande | Stocker le résultat d'une commande | ||
| < | < | ||
| Line 12: | Line 15: | ||
| bonjour # appel de la fonction | bonjour # appel de la fonction | ||
| </ | </ | ||
| + | Fonction paramètres | ||
| + | < | ||
| + | function ecrire { | ||
| + | echo "$1 $2" | ||
| + | } | ||
| + | ecrire ' | ||
| + | </ | ||
| + | Tableau | ||
| + | < | ||
| + | tab[0]=" | ||
| + | tab[1]=" | ||
| + | |||
| + | echo $tab[1] | ||
| + | |||
| + | for mot in ${tab[*]} | ||
| + | do | ||
| + | echo $mot; | ||
| + | done | ||
| + | |||
| + | </ | ||
| + | |||
| + | Arguments de script | ||
| + | < | ||
| + | echo $1 #premier argument | ||
| + | echo $2 | ||
| + | echo " | ||
| + | echo $* #tous les arguments | ||
| + | </ | ||
| + | |||
| + | Afficher la sortie de la dernière commande passée | ||
| + | < | ||
| + | echo $_ | ||
| + | </ | ||
| + | |||
| + | Afficher le bon résultat de la dernière commande | ||
| + | < | ||
| + | echo " | ||
| + | </ | ||
| + | |||
| + | Afficher le nombre de paramètres | ||
| + | < | ||
| + | echo " | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
bash.1707749836.txt.gz · Last modified: 2024/02/12 14:57 by 195.221.243.132