Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteProchaine révisionLes deux révisions suivantes | ||
documentation:tools:langages:bash [2020/07/16 11:32] – [Références] ltaulell | documentation:tools:langages:bash [2023/01/13 08:47] – [string replace] ltaulell | ||
---|---|---|---|
Ligne 5: | Ligne 5: | ||
<note important> | <note important> | ||
- | |||
- | |||
- | ===== Références ===== | ||
- | |||
- | |||
- | Le manuel de Bash, en français : | ||
- | * http:// | ||
- | |||
- | Nombreux trucs & Astuces : | ||
- | * https:// | ||
- | * https:// | ||
- | * https:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * http:// | ||
- | * https:// | ||
- | * http:// | ||
- | * http:// | ||
- | * https:// | ||
- | |||
- | ===== Ordre de chargement des config de shell ===== | ||
- | |||
- | * Bash vs zsh | ||
- | |||
- | Voir ces schémas (en) : | ||
- | |||
- | __Expected behavior:__ | ||
- | {{ : | ||
- | |||
- | __Reality goes ugly:__ | ||
- | {{ : | ||
- | |||
- | Source: http:// | ||
- | |||
- | (outil de création des diagrammes : http:// | ||
- | |||
Ligne 55: | Ligne 11: | ||
===== Exemples & Astuces ===== | ===== Exemples & Astuces ===== | ||
- | ==== ShellCheck ==== | ||
- | This utility is installed on PMSN. **Use it without moderation**. You can also [[https:// | ||
- | ==== Debugging ==== | ||
- | * Use " | ||
- | |||
- | <code bash> | ||
- | set -euo pipefail | ||
- | </ | ||
- | |||
- | * Trace each command verbosely: | ||
- | |||
- | <code bash> | ||
- | set -x | ||
- | </ | ||
- | |||
- | * explain code & errors | ||
- | |||
- | <code bash> | ||
- | shellcheck monscript.sh | ||
- | </ | ||
- | |||
- | * online version: https:// | ||
- | * online explanation for error code '' | ||
- | |||
- | ==== string replace ==== | ||
- | |||
- | * remplace '' | ||
- | |||
- | <code bash> | ||
- | SCRATCHDIR=${SGE_O_WORKDIR/" | ||
- | </ | ||
- | |||
- | * nomme '' | ||
- | |||
- | <code bash> | ||
- | INFILE=$1 | ||
- | TMPNAME=$(basename " | ||
- | OUTFILE=" | ||
- | LOGFILE=" | ||
- | </ | ||
- | |||
- | * Message d' | ||
- | |||
- | <code bash> | ||
- | # ${TMPDIR:?" | ||
- | |||
- | result=$(ls " | ||
- | if [[ " | ||
- | then | ||
- | echo " | ||
- | exit 1 | ||
- | fi | ||
- | </ | ||
==== pattern matching ==== | ==== pattern matching ==== | ||
Ligne 233: | Ligne 136: | ||
data=" | data=" | ||
</ | </ | ||
+ | |||
+ | <note warning> | ||