Update docs/Linux/2025-05-20-bash-life.md
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -14,7 +14,7 @@ set -euo pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
```
|
```
|
||||||
|
|
||||||
## BASH_REMATCH et les tests de regex `=~` avec l'opérateur conditionnel `[[`:
|
### BASH_REMATCH et les tests de regex `=~` avec l'opérateur conditionnel `[[`:
|
||||||
[BASH_REMATCH special variable](https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-BASH_005fREMATCH)
|
[BASH_REMATCH special variable](https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-BASH_005fREMATCH)
|
||||||
|
|
||||||
Lors d'un test de regex avec du type `if [[ ${variable} =~ ${pattern} ]]`, tous les résultats qui "matchent" le pattern sont stockés dans un variable spéciale `BASH_REMATCH`, qui est en fait un array. On peut donc itérer dessus.
|
Lors d'un test de regex avec du type `if [[ ${variable} =~ ${pattern} ]]`, tous les résultats qui "matchent" le pattern sont stockés dans un variable spéciale `BASH_REMATCH`, qui est en fait un array. On peut donc itérer dessus.
|
||||||
|
|||||||
Reference in New Issue
Block a user