informatique:linux:programmation_shell
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| informatique:linux:programmation_shell [2023/10/02 13:35] – [Lire depuis un fichier] pteu | informatique:linux:programmation_shell [2024/10/02 15:10] (current) – [pipe ("|")] test de présence d'un flux envoyé sur l'entrée standard (pipe) pteu | ||
|---|---|---|---|
| Line 470: | Line 470: | ||
| $ false | true; echo $? | $ false | true; echo $? | ||
| 1 | 1 | ||
| + | </ | ||
| + | |||
| + | * pour écrire un script qui traite l' | ||
| + | <code bash> | ||
| + | # s'il existe un pipe sur l' | ||
| + | if [ -p /dev/stdin ]; then | ||
| + | source="/ | ||
| + | else | ||
| + | source=" | ||
| + | fi | ||
| </ | </ | ||
| ===== read ===== | ===== read ===== | ||
informatique/linux/programmation_shell.1696253708.txt.gz · Last modified: 2023/10/02 13:35 by pteu