Projet

Général

Profil

Révision 15ed27d8

Ajouté par Julien Enselme il y a plus de 9 ans

Use getopts to print help and to parse script arguments.

Voir les différences:

bin/d7-generate-nginx-map.sh
1 1
#!/bin/sh
2 2

  
3
. /home/assos/bin/scripts-config.sh
3
usage() {
4
    help=<<EOF
5
Generate nginx map from Drupal's sites.php.
4 6

  
5
help=<<EOF
6
Generate nginx map from Drupal's sites.php
7
No option required.
7 8

  
8 9
The left part of the map is $http_host$uri.
9 10
The right part is $subdir.
10 11
EOF
12
    echo -e "${help}"
13
}
14
. /home/assos/bin/print-help-if-required.sh
15

  
16

  
17
. /home/assos/bin/scripts-config.sh
11 18

  
12 19
# Only for sites with url like assos.centrale-marseille.fr/subsite (other sites don't need to be in the map)
13 20
cut -d"'" -f2,4 "${sites_php}" |\

Formats disponibles : Unified diff