Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
coding:bash [2024/08/31 11:53] jango |
coding:bash [2025/06/16 05:06] (aktuell) admin |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
[[: | [[: | ||
+ | |||
<code bash> | <code bash> | ||
Zeile 32: | Zeile 33: | ||
echo " | echo " | ||
done | done | ||
+ | </ | ||
+ | |||
+ | Arrays | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | |||
+ | # Declare an associative array called fruits | ||
+ | declare -A fruits | ||
+ | |||
+ | # Assign key-value pairs to the array | ||
+ | fruits[apple]=" | ||
+ | fruits[banana]=" | ||
+ | fruits[grape]=" | ||
+ | |||
+ | # Print specific element | ||
+ | echo "The color of an apple is ${fruits[apple]}." | ||
+ | |||
+ | # Iterate through the array | ||
+ | for key in " | ||
+ | echo "$key: ${fruits[$key]}" | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | =====EOF===== | ||
+ | |||
+ | <code bash> | ||
+ | cat <<' | ||
+ | Das ist ein Test | ||
+ | |||
+ | Mehr Zeilen | ||
+ | EOF | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | test=$(cat <<' | ||
+ | Das ist ein Test | ||
+ | |||
+ | Mehr Zeilen | ||
+ | EOF | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | cat <<' | ||
+ | Das ist ein Test | ||
+ | |||
+ | Mehr Zeilen | ||
+ | EOF | ||
</ | </ | ||