Ceci est une ancienne révision du document !
Bash
TODO : Extraire des exemples de https://github.com/benjamin-feron/goalkicker-looter/blob/main/goalkicker-looter.sh
Recharger le fichier de profile (.bashrc)
source ~/.bashrc
Variante
. ~/.bashrc
Tableaux
Déclaration
declare -A ARRAY ARRAY[0]="foo" ARRAY[1]="bar"
Boucle sur un tableau
for item in "${ARRAY[@]}"; do
[...do something whith $item...]
done
Divers
Gérer les arguments de commande
while :; do
case $1 in
-u|--user)
USERNAME=${2}
shift
;;
-h|--host)
HOSTS=${2}
shift
;;
--help)
show_help
exit
;;
-v|--verbose)
VERBOSE=$((verbose + 1))
;;
-q|--quiet)
QUIET=1
;;
--)
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*)
break
esac
shift
done