Ceci est une ancienne révision du document !


Bash

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

options=$(getopt -o c:hp:s: -l hide-pagination,page-count:page-size:sort:,help -- "$@")
eval set -- "$options"
while true; do
  case "$1" in
    -c|--page-count)
      PAGE_COUNT=$2
      shift 2
      ;;
    -h|--hide-pagination)
      HIDE_PAGES=1
      shift
      ;;
    -p|--page-size)
      PAGE_SIZE=$2
      shift 2
      ;;
    -s|--sort)
      SORT="$2"
      shift 2
      ;;
    --help)
      show_help
      exit
      ;;
    --)
      shift
      break
      ;;
  esac
done

REPO="$1"
shift