Compare commits
3 commits
9cb9f7b69d
...
d8aa729895
Author | SHA1 | Date | |
---|---|---|---|
d8aa729895 | |||
7035820661 | |||
b4550c8951 |
3 changed files with 6 additions and 6 deletions
|
@ -41,7 +41,7 @@ debug() {
|
|||
local message="$*"
|
||||
# si la variable $DEBUG n'est pas définie ou si sa valeur
|
||||
# est différente de 1, on quite notre fonction.
|
||||
[ -z "$DEBUG" || $DEBUG -ne 1 ] && return
|
||||
[[ -z "$DEBUG" || $DEBUG -ne 1 ]] && return
|
||||
[ -z "$message" ] && return
|
||||
>&2 msg "DEBUG: $message"
|
||||
}
|
||||
|
@ -135,13 +135,13 @@ interprètera nos commandes échappées avec l'antislash**.
|
|||
La couleur c'est bien, mais si on décide de rediriger une sortie (ou les deux)
|
||||
de notre script dans un fichier voici son contenu ouvert dans `vim`:
|
||||
|
||||
```none
|
||||
```shell
|
||||
$ DEBUG=1 ./test.sh >error.txt 2>&1
|
||||
$ vim error.txt
|
||||
[34mDEBUG: We will display a message[0m
|
||||
^[[34mDEBUG: We will display a message^[[0m
|
||||
Test Message
|
||||
[34mDEBUG: We will display an error[0m
|
||||
[31mERROR: This is an error[0m
|
||||
^[[34mDEBUG: We will display an error^[[0m
|
||||
^[[31mERROR: This is an error^[[0m
|
||||
```
|
||||
|
||||
Nous allons justement régler ce problème dans le paragraphe suivant.
|
||||
|
|
BIN
content/assets/backgrounds/article_bash_messages.jpg
Normal file
BIN
content/assets/backgrounds/article_bash_messages.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
Loading…
Add table
Add a link
Reference in a new issue