commit 3e9236bd505a73664a70e545002558ede5e50a83
Author: Julien Enselme <julien.enselme@centrale-marseille.fr>
Date:   Tue Oct 14 22:06:45 2014 +0200

    Update scritp so they respect the new convention.
    
    - Variables are quoted.
    - $(…) are quoted.

diff --git a/bin/all-reset-permissions.sh b/bin/all-reset-permissions.sh
index c4b102ab..950afc3c 100755
--- a/bin/all-reset-permissions.sh
+++ b/bin/all-reset-permissions.sh
@@ -5,20 +5,20 @@
 # This script puts the correct permissions to sites folders, settings.php and scripts.
 
 ######### drupal 7
-for dir in $(find $d7_dir_sites -type d -maxdepth 1 -mindepth 1 ! -name all) ; do
-    chmod 755 $dir
-    chmod 400 $dir/settings.php
-    chmod 400 $dir/settings.local.php
+for dir in "$(find "${d7_dir_sites}" -type d -maxdepth 1 -mindepth 1 ! -name all)" ; do
+    chmod 755 "${dir}"
+    chmod 400 "${dir}/settings.php"
+    chmod 400 "${dir}/settings.local.php"
 done
 
 ####### bin
-chmod -R 700 $dir_scripts
+chmod -R 700 "${dir_scripts}"
 
 ####### backup
-chmod -R 700 $dir_backup
+chmod -R 700 "${dir_backup}"
 
 ####### log
-chmod -R 700 $dir_log
+chmod -R 700 "${dir_log}"
 
 ####### private
-chmod -R 700 $dir_private
+chmod -R 700 "${dir_private}"
diff --git a/bin/d7-all-drush.sh b/bin/d7-all-drush.sh
index 50e42ecf..49f0f0f4 100755
--- a/bin/d7-all-drush.sh
+++ b/bin/d7-all-drush.sh
@@ -5,11 +5,11 @@
 
 help="# ARGS: drush_command"
 
-check_arguments $# 1 "$help"
+check_arguments "$#" 1 "${help}"
 
-for dir in $(find $d7_dir_sites -maxdepth 1 -mindepth 1 -type d ! -name all | sort) ; do
-    cd $dir
-    echo $dir
+for dir in "$(find "${d7_dir_sites}" -maxdepth 1 -mindepth 1 -type d ! -name all | sort)" ; do
+    cd "${dir}"
+    echo "${dir}"
     drush "$@"
     sleep 5
 done
diff --git a/bin/d7-all-dump-full.sh b/bin/d7-all-dump-full.sh
index b97b45db..5c4bd778 100755
--- a/bin/d7-all-dump-full.sh
+++ b/bin/d7-all-dump-full.sh
@@ -3,7 +3,7 @@
 . /home/assos/bin/scripts-config.sh
 . /home/assos/bin/scripts-utils.sh
 
-current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
+current_date="$(date "+%Y-%m-%d-%Hh%Mm%Ss")"
 
 # Dump D7 databases at once.
-mysqldump --defaults-extra-file=$myassos_cnf --all-databases | gzip > $d7_dir_full_backup/myassos/$current_date.d7_full.sql.gz
+mysqldump --defaults-extra-file="${myassos_cnf}" --all-databases | gzip > "${d7_dir_full_backup}/myassos/${current_date}.d7_full.sql.gz"
diff --git a/bin/d7-all-dump-individual.sh b/bin/d7-all-dump-individual.sh
index 1d95153a..2d51eedd 100755
--- a/bin/d7-all-dump-individual.sh
+++ b/bin/d7-all-dump-individual.sh
@@ -5,19 +5,19 @@
 
 help="# ARGS: auto or manual"
 
-check_arguments $# 1 "$help"
+check_arguments "$#" 1 "$help"
 
-current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
+current_date="$(date "+%Y-%m-%d-%Hh%Mm%Ss")"
 
-cd $d7_dir_sites
+cd "${d7_dir_sites}"
 
-for dir in $(find . -maxdepth 1 -mindepth 1 -type d ! -name all | cut -c3-) ; do
-    cd $dir
+for dir in "$(find . -maxdepth 1 -mindepth 1 -type d ! -name all | cut -c3-)" ; do
+    cd "${dir}"
     drush cc all
-    if [ $1 = 'auto' ] ; then
-        drush sql-dump --result-file=$d7_dir_individual_auto_backup/$dir/$current_date.$dir.sql --gzip
+    if [ "$1" = 'auto' ] ; then
+        drush sql-dump --result-file="${d7_dir_individual_auto_backup}/${dir}/${current_date}.${dir}.sql --gzip"
     else
-        drush sql-dump --result-file=$d7_dir_individual_manual_backup/$dir/$current_date.$dir.sql --gzip
+        drush sql-dump --result-file="${d7_dir_individual_manual_backup}/${dir}/${current_date}.${dir}.sql --gzip"
     fi
     cd -
 done
diff --git a/bin/d7-all-releases-info.sh b/bin/d7-all-releases-info.sh
index 43300741..39e4ce0f 100755
--- a/bin/d7-all-releases-info.sh
+++ b/bin/d7-all-releases-info.sh
@@ -6,17 +6,17 @@
 # and all versions that are available for same project on drupal.org
 
 # modules
-cd $d7_dir_sites/all/modules
-for dir in $(ls -1) ; do
-    if [ -d $dir ] ; then
-        drush pm-releases $dir
+cd "${d7_dir_sites}/all/modules"
+for dir in "$(ls -1)" ; do
+    if [ -d "${dir}" ] ; then
+        drush pm-releases "${dir}"
     fi
 done
 
 # themes
-cd $d7_dir_sites/all/themes
-for dir in $(ls -1) ; do
-    if [ -d $dir ] ; then
-        drush pm-releases $dir
+cd "${d7_dir_sites}/all/themes"
+for dir in "$(ls -1)" ; do
+    if [ -d "${dir}" ] ; then
+        drush pm-releases "${dir}"
     fi
 done
diff --git a/bin/d7-all-reset-variables.sh b/bin/d7-all-reset-variables.sh
index db29b216..5d2e8cff 100755
--- a/bin/d7-all-reset-variables.sh
+++ b/bin/d7-all-reset-variables.sh
@@ -2,8 +2,8 @@
 
 . /home/assos/bin/scripts-config.sh
 
-for dir in $(find $d7_dir_sites -maxdepth 1 -mindepth 1 -type d ! -name all | sort) ; do
-    echo $dir
-    site_name=$(echo $dir | tr '.' '\n' | tail -n 1)
-    d7-reset-variables.sh $site_name
+for dir in "$(find "${d7_dir_sites}" -maxdepth 1 -mindepth 1 -type d ! -name all | sort)" ; do
+    echo "${dir}"
+    site_name="$(echo "${dir}" | tr '.' '\n' | tail -n 1)"
+    d7-reset-variables.sh "${site_name}"
 done
diff --git a/bin/d7-all-security-review.sh b/bin/d7-all-security-review.sh
index 89b7e2ea..8484da46 100755
--- a/bin/d7-all-security-review.sh
+++ b/bin/d7-all-security-review.sh
@@ -3,4 +3,4 @@
 . /home/assos/bin/scripts-config.sh
 
 # grep -v success to keep site_name and error lines.
-bash -c "d7-all-drush.sh security-review --store |& grep -v success | mail -s d7-all-security-review.sh $email_multi_assos"
+bash -c "d7-all-drush.sh security-review --store |& grep -v success | mail -s d7-all-security-review.sh ${email_multi_assos}"
diff --git a/bin/d7-all-update-contrib.sh b/bin/d7-all-update-contrib.sh
index 122a2ee5..68af1550 100755
--- a/bin/d7-all-update-contrib.sh
+++ b/bin/d7-all-update-contrib.sh
@@ -18,5 +18,5 @@ d7-all-drush.sh -y dis update
 
 d7-all-drush.sh cron
 
-git add -A $d7_dir_sites/all
+git add -A "${d7_dir_sites}/all"
 commit "Weekly update of contrib modules"
diff --git a/bin/d7-all-update-core.sh b/bin/d7-all-update-core.sh
index 73f4ba93..61e33e57 100755
--- a/bin/d7-all-update-core.sh
+++ b/bin/d7-all-update-core.sh
@@ -6,7 +6,7 @@ help="This script is intended to help you update drupal core. It fellows steps d
 Please do not launch in cron."
 
 if ! tty -s ; then
-    echo $help
+    echo "${help}"
     exit 1
 fi
 
@@ -14,13 +14,13 @@ set -e # Exit immediatly if a command exits with a non zero value
 
 # Backup translations
 translations_backupdir=/var/tmp
-cp $translations_fr $translations_backupdir
+cp "${translations_fr}" "${translations_backupdir}"
 
 d7-all-dump-individual.sh manual
 
 d7-all-drush.sh -y en update
 
-cd $d7_dir
+cd "${d7_dir}"
 drush -y upc drupal
 
 d7-all-drush.sh -y updb
@@ -30,13 +30,13 @@ d7-all-drush.sh -y dis update
 # Get the new subversion number:
 # cd to $d7_dir, filter drush status to get the drupal version line,
 # remove end line whitespaces, and get the 2 last caracters of the string.
-drupal_version=$(cd $d7_dir && drush status | grep "Drupal version" | tr -d ' ' | tail -c 3)
+drupal_version="$(cd "${d7_dir}" && drush status | grep "Drupal version" | tr -d ' ' | tail -c 3)"
 
 # Try to download new translation. If it fails, restore the old one.
-if ! curl -f http://ftp.drupal.org/files/translations/7.x/drupal/drupal-7.$drupal_version.fr.po -o $translations_fr ; then
-    cp $translations_backupdir/fr.po $translations_fr
+if ! curl -f "http://ftp.drupal.org/files/translations/7.x/drupal/drupal-7.${drupal_version}.fr.po" -o "${translations_fr}" ; then
+    cp "${translations_backupdir}/fr.po" "${translations_fr}"
 fi
 
 echo "Check for settings.php update."
 echo "If everything is fine, run:"
-echo -e "\tgit add -A drupal7 && git commit -m 'Udpate to 7.$drupal_version'"
+echo -e "\tgit add -A drupal7 && git commit -m 'Udpate to 7.${drupal_version}'"
diff --git a/bin/d7-all-update-settings.sh b/bin/d7-all-update-settings.sh
index 6a96310a..8e3704db 100755
--- a/bin/d7-all-update-settings.sh
+++ b/bin/d7-all-update-settings.sh
@@ -5,15 +5,15 @@
 
 # This script updates all drupal 7 settings.php according to a new template. Site informations located in settings.local.php are left intact.
 
-for settings in $(find $d7_dir_sites -mindepth 2 -maxdepth 2 -name settings.php) ; do
+for settings in "$(find "${d7_dir_sites}" -mindepth 2 -maxdepth 2 -name settings.php)" ; do
 
     # We go into the settings.php directory.
-    settings_dir=$(give_dir $settings)
-    cd $settings_dir
+    settings_dir="$(give_dir "${settings}")"
+    cd "${settings_dir}"
 
-    chmod 700 $settings
-    rm $settings
+    chmod 700 "${settings}"
+    rm "${settings}"
 
-    cp $d7_settings settings.php
+    cp "${d7_settings}" settings.php
     chmod 400 settings.php
 done
diff --git a/bin/d7-all-usage.sh b/bin/d7-all-usage.sh
index 941ac9bc..7b67dc16 100755
--- a/bin/d7-all-usage.sh
+++ b/bin/d7-all-usage.sh
@@ -4,9 +4,9 @@
 
 # For each modules and themes, list and count how much sites use its.
 
-cd $d7_dir_sites
+cd "${d7_dir_sites}"
 
-for line in $(drush pml --no-core --pipe); do
-    usage.sh d7 enabled "$line"
+for line in "$(drush pml --no-core --pipe)"; do
+    usage.sh d7 enabled "${line}"
     echo -e "\n"
 done
diff --git a/bin/d7-create-site.sh b/bin/d7-create-site.sh
index 890d370b..af32189e 100755
--- a/bin/d7-create-site.sh
+++ b/bin/d7-create-site.sh
@@ -1,15 +1,15 @@
 #!/bin/sh
 
 . /home/assos/bin/scripts-config.sh
-. /home/assos/bin/scripts-config-site.sh $1
+. /home/assos/bin/scripts-config-site.sh "$1"
 . /home/assos/bin/scripts-utils.sh
 
 help="# ARGS: site_name site_mail admin_password [--no-init-database]"
 
-check_arguments $# 3 "$help"
+check_arguments "$#" 3 "${help}"
 
 # Check if site already exists.
-if site_exists $d7_site_name ; then
+if site_exists "${d7_site_name}" ; then
     exit 1
 fi
 
@@ -26,89 +26,89 @@ if ! work_tree_clean ; then
 fi
 
 # "-" is forbidden because it provokes database error.
-if [ $(echo $1 | grep -) ] ; then
+if [ "$(echo "$1" | grep -)" ] ; then
     echo '"-" is forbidden in the site name'
     exit 1
 fi
 
 # Site name length must be lower or equal to 16 due to database limitations.
-if [ $(echo $1 | wc -c) -gt 16 ] ; then
+if [ "$(echo "$1" | wc -c)" -gt 16 ] ; then
     echo "site name can't have more than 16 characters"
     exit 1
 fi
 
 # drush site-install needs the translation file
-if [ ! -f $translation_fr ] ; then
+if [ ! -f "${translation_fr}" ] ; then
     echo "The translation file $translation_fr does not exist"
     exit 1
 fi
 
 ###### Initialisation
-cd $d7_dir
-site_password=$(generate_password)
+cd "${d7_dir}"
+site_password="$(generate_password)"
 site_line_sites_php="\$sites['assos.centrale-marseille.fr.$d7_site_name'] = 'assos.centrale-marseille.fr.$d7_site_name';"
 site_line_aliases_drushrc_php="\$aliases['$d7_site_name'] = array('uri' => 'assos.centrale-marseille.fr/$d7_site_name', 'root' => '/home/assos/drupal7/', );"
 # NB: site_name is initialised in script-config-site.sh
-site_mail=$2
-admin_password=$3
+site_mail="$2"
+admin_password="$3"
 
 
 ###### Main
-mkdir $d7_site_dir
-dir_site_name="assos.centrale-marseille.fr.$d7_site_name"
+mkdir "${d7_site_dir}"
+dir_site_name="assos.centrale-marseille.fr.${d7_site_name}"
 
 # Backup requirements
-mkdir $d7_dir_individual_auto_backup/$dir_site_name
-mkdir $d7_dir_individual_manual_backup/$dir_site_name
-current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
+mkdir "${d7_dir_individual_auto_backup}/${dir_site_name}"
+mkdir "${d7_dir_individual_manual_backup}/${dir_site_name}"
+current_date="$(date "+%Y-%m-%d-%Hh%Mm%Ss")"
 
 # NB : ls sort by considering the 1st characters
-touch $d7_dir_individual_auto_backup/$dir_site_name/$current_date.$dir_site_name.sql
-touch $d7_dir_individual_auto_backup/$dir_site_name/$current_date.$dir_site_name.sql2
-touch $d7_dir_individual_auto_backup/$dir_site_name/$current_date.$dir_site_name.sql3
-touch $d7_dir_individual_auto_backup/$dir_site_name/$current_date.$dir_site_name.sql4
+touch "${d7_dir_individual_auto_backup}/${dir_site_name}/${current_date}.${dir_site_name}.sql"
+touch "${d7_dir_individual_auto_backup}/${dir_site_name}/${current_date}.${dir_site_name}.sql2"
+touch "${d7_dir_individual_auto_backup}/${dir_site_name}/${current_date}.${dir_site_name}.sql3"
+touch "${d7_dir_individual_auto_backup}/${dir_site_name}/${current_date}.${dir_site_name}.sql4}"
 
 # Create and grant privileges on database
-mysql --defaults-extra-file=$myassos_cnf -e "CREATE DATABASE $d7_site_name"
-mysql --defaults-extra-file=$myassos_cnf -e "GRANT ALL PRIVILEGES ON $d7_site_name.* TO '$d7_site_name'@'%' IDENTIFIED BY '$site_password'"
+mysql --defaults-extra-file="${myassos_cnf}" -e "CREATE DATABASE ${d7_site_name}"
+mysql --defaults-extra-file="${myassos_cnf}" -e "GRANT ALL PRIVILEGES ON ${d7_site_name}.* TO '${d7_site_name}'@'%' IDENTIFIED BY '${site_password}'"
 
 # Create settings.local.php
-cp $d7_settings $d7_site_settings
-generate_settings_local $d7_site_name $site_password $d7_settings_local_template $d7_site_settings_local
+cp "${d7_settings}" "${d7_site_settings}"
+generate_settings_local "${d7_site_name}" "${site_password}" "${d7_settings_local_template}" "${d7_site_settings_local}"
 
 # Install the site
-drush site-install -y standard --account-mail=$site_mail --account-name="admin" --account-pass=$admin_password --locale=fr --site-mail=$site_mail --site-name=$d7_site_name --sites-subdir=$dir_site_name
+drush site-install -y standard --account-mail="${site_mail}" --account-name="admin" --account-pass="${admin_password}" --locale=fr --site-mail="${site_mail}" --site-name="${d7_site_name}" --sites-subdir="${dir_site_name}"
 
 # Create symbolic link
-cd $d7_dir
-ln -s . $d7_site_name
-git add $d7_site_name
+cd "${d7_dir}"
+ln -s . "${d7_site_name}"
+git add "${d7_site_name}"
 
 # Update sites.php
-chmod +w $sites_php
-echo $site_line_sites_php >> $sites_php
-chmod 400 $sites_php
+chmod +w "${sites_php}"
+echo "${site_line_sites_php}" >> "${sites_php}"
+chmod 400 "${sites_php}"
 
 ### Update aliases.drushrc.php
 # For site
-echo $site_line_aliases_drushrc_php >> $aliases_drushrc_php
+echo "${site_line_aliases_drushrc_php}" >> "${aliases_drushrc_php}"
 # @d7
-sed s/"'site-list' => array("/"'site-list' => array(%'assos.centrale-marseille.fr\/$d7_site_name',"/ < $aliases_drushrc_php | tr '%' '\n    ' > $dir_tmp/aliases.tmp
-mv $dir_tmp/aliases.tmp $aliases_drushrc_php
+sed s/"'site-list' => array("/"'site-list' => array(%'assos.centrale-marseille.fr\/$d7_site_name',"/ < "${aliases_drushrc_php}" | tr '%' '\n    ' > "${dir_tmp}/aliases.tmp"
+mv "${dir_tmp}/aliases.tmp" "${aliases_drushrc_php}"
 
-commit "Creation of site: $d7_site_name"
+commit "Creation of site: ${d7_site_name}"
 
 # Next Instructions
-if [ $init_db -eq 0 ] ; then
+if [ "${init_db}" -eq 0 ] ; then
     exit 0
 fi
 
 # Init variables
-d7-reset-variables.sh $d7_site_name
+d7-reset-variables.sh "${d7_site_name}"
 
 # Permissions
-chmod -R 755 $d7_site_dir
-chmod 400 $d7_site_settings
+chmod -R 755 "${d7_site_dir}"
+chmod 400 "${d7_site_settings}"
 
 # Last instructions
 echo "Last instructions:"
diff --git a/bin/d7-delete-site.sh b/bin/d7-delete-site.sh
index 59923466..c97bf9d8 100755
--- a/bin/d7-delete-site.sh
+++ b/bin/d7-delete-site.sh
@@ -1,12 +1,12 @@
 #!/bin/sh
 
 . /home/assos/bin/scripts-config.sh
-. scripts-config-site.sh $1
+. scripts-config-site.sh "$1"
 . scripts-utils.sh
 
 help="# ARGS: site name."
 
-check_arguments $# 1 "$help"
+check_arguments "$#" 1 "${help}"
 
 echo 'Awaiting for git status. (may take a while)'
 if ! work_tree_clean ; then
@@ -15,34 +15,34 @@ if ! work_tree_clean ; then
 fi
 
 echo 'Delete database.'
-mysql --defaults-extra-file=$myassos_cnf -e "DROP DATABASE $d7_site_name"
+mysql --defaults-extra-file="${myassos_cnf}" -e "DROP DATABASE ${d7_site_name}"
 
 echo 'Delete MYSQL user.'
-mysql --defaults-extra-file=$myassos_cnf -e "DROP USER '$d7_site_name'@'%'"
+mysql --defaults-extra-file="${myassos_cnf}" -e "DROP USER '${d7_site_name}'@'%'"
 
 echo "Delete site's folder."
-chmod -R 700 $d7_site_dir
-rm -r $d7_site_dir
+chmod -R 700 "${d7_site_dir}"
+rm -r "${d7_site_dir}"
 
 # Delete symbolic link.
-rm $d7_dir/$d7_site_name
+rm "${d7_dir}/${d7_site_name}"
 
 echo 'Remove site line from sites.php'
-chmod +w $sites_php
-grep -sv "^\$.*$d7_site_name';$" $sites_php > $dir_tmp/sites.php
-mv $dir_tmp/sites.php $sites_php
-chmod 400 $sites_php
+chmod +w "${sites_php}"
+grep -sv "^\$.*$d7_site_name';$" "${sites_php}" > "${dir_tmp}/sites.php"
+mv "${dir_tmp}/sites.php" "${sites_php}"
+chmod 400 "${sites_php}"
 
 echo 'Remove site alias from aliases.drushrc.php'
-grep -sv "$d7_site_name'" $aliases_drushrc_php > $dir_tmp/aliases.php
-mv $dir_tmp/aliases.php $aliases_drushrc_php
+grep -sv "${d7_site_name}'" "${aliases_drushrc_php}" > "${dir_tmp}/aliases.php"
+mv "${dir_tmp}/aliases.php" "${aliases_drushrc_php}"
 
 echo 'Delete database backups.'
-rm -r $d7_dir_individual_auto_backup/assos.centrale-marseille.fr.$d7_site_name
-rm -r $d7_dir_individual_manual_backup/assos.centrale-marseille.fr.$d7_site_name
+rm -r "${d7_dir_individual_auto_backup}/assos.centrale-marseille.fr.${d7_site_name}"
+rm -r "${d7_dir_individual_manual_backup}/assos.centrale-marseille.fr.${d7_site_name}"
 
 echo "Don't forget to:"
 echo "- Refresh node site on default"
 echo "- Check particular behavior (normally detailed on site node)"
 
-commit "Deletion of site: $d7_site_name"
+commit "Deletion of site: ${d7_site_name}"
diff --git a/bin/d7-reset-piwik-variables.sh b/bin/d7-reset-piwik-variables.sh
index 337057ed..13ae6106 100755
--- a/bin/d7-reset-piwik-variables.sh
+++ b/bin/d7-reset-piwik-variables.sh
@@ -15,7 +15,7 @@ drush -yq vset piwik_site_search 1
 
 ##### Specific
 # Note: you can read the piwik site id from the url in piwik
-case $1 in
+case "$1" in
     accueil)
 	piwik_id=286
 	;;
@@ -76,17 +76,17 @@ case $1 in
     tvp)
 	piwik_id=110
 	;;
-	ftorregrosa)
-    piwik_id=314
-    ;;
+    ftorregrosa)
+	piwik_id=314
+	;;
     *)
 	piwik_id=287
 	;;
 esac
 
 # Default is an exception and cannot be treated in the case
-if echo $1 | grep default ; then
+if echo "$1" | grep default ; then
     piwik_id=101
 fi
 
-drush -yq vset piwik_site_id $piwik_id
+drush -yq vset piwik_site_id "${piwik_id}"
diff --git a/bin/d7-reset-variables.sh b/bin/d7-reset-variables.sh
index 570e74e1..3e0facdd 100755
--- a/bin/d7-reset-variables.sh
+++ b/bin/d7-reset-variables.sh
@@ -4,20 +4,20 @@
 
 # ARGS: [site_name]
 
-if [ ! -z $1 ] ; then
-    . scripts-config-site.sh $1
+if [ -n "$1" ] ; then
+    . scripts-config-site.sh "$1"
     # default is an exception to the rule
-    if echo $1 | grep default > /dev/null ; then
-	    cd $d7_dir_sites/default
+    if echo "$1" | grep default > /dev/null ; then
+	    cd "${d7_dir_sites}/default"
     else
-	cd $d7_site_dir
+	cd "${d7_site_dir}"
     fi
 fi
 
-current_timestamp=$(date "+%s")
+current_timestamp="$(date "+%s")"
 
-random_1=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
-random_2=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
+random_1="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")"
+random_2="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")"
 
 ####### General variables
 drush -yq vset --always-set reverse_proxy TRUE
@@ -41,7 +41,7 @@ drush -yq vset hidden_captcha_label "$random_1 + $random_2"
 
 
 ####### Piwik
-d7-reset-piwik-variables.sh $d7_site_name
+d7-reset-piwik-variables.sh "${d7_site_name}"
 
 ###### Security review
 # For untrusted roles:
diff --git a/bin/d7-sync-site.sh b/bin/d7-sync-site.sh
index 1737bba9..d0fcfcb9 100755
--- a/bin/d7-sync-site.sh
+++ b/bin/d7-sync-site.sh
@@ -14,65 +14,65 @@ EOF
 . /home/assos/bin/scripts-config.sh
 . /home/assos/bin/scripts-utils.sh
 
-check_arguments $# 2 "$help"
+check_arguments "$#" 2 "${help}"
 
 
 # Create site if necessary
-if ! site_exists $2 > /dev/null ; then
+if ! site_exists "$2" > /dev/null ; then
     echo "$2 does not exit. We will create it"
-    d7-create-site.sh $2 --no-init-database
+    d7-create-site.sh "$2" --no-init-database
     # if the site is new, there is no database
     new_site=1
 fi
 
 
 # Backup the database of SOURCE_SITE
-current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
-if [ $1 = "default" ] ; then
-    dir=$2
+current_date="$(date "+%Y-%m-%d-%Hh%Mm%Ss")"
+if [ "$1" = "default" ] ; then
+    dir="$2"
 else
-    dir=assos.centrale-marseille.fr.$2
+    dir="assos.centrale-marseille.fr.$2"
 fi
-if [ -z "$new_site" ] ; then
-    drush -y @$1 sql-dump --result-file=$d7_dir_individual_manual_backup/$dir/$current_date.$dir.sql --gzip
+if [ -z "${new_site}" ] ; then
+    drush -y "@$1" sql-dump --result-file="${d7_dir_individual_manual_backup}/${dir}/${current_date}.${dir}.sql" --gzip
 fi
 
 
 # Sync files
-drush -y rsync --delete --exclude="*.php" @${1}:%site @${2}:%site
+drush -y rsync --delete --exclude="*.php" "@${1}:%site" "@${2}:%site"
 
 
 # Sync databases
 ## Save file system
-if [ -z "$new_site" ] ; then
-    private_path=$(drush @$2 vget --format=string file_private_path 2> /dev/null)
-    public_path=$(drush @$2 vget --format=string file_public_path 2> /dev/null)
-    temp_path=$(drush @$2 vget --format=string file_temporary_path 2> /dev/null)
+if [ -z "${new_site}" ] ; then
+    private_path="$(drush "@$2" vget --format=string file_private_path 2> /dev/null)"
+    public_path="$(drush "@$2" vget --format=string file_public_path 2> /dev/null)"
+    temp_path="$(drush "@$2" vget --format=string file_temporary_path 2> /dev/null)"
 fi
 
 ## Sync
-current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
-sql_file=$dir_tmp/$current_date.$1.sql
-drush -y @$1 sql-dump --result-file=$sql_file
-sed -i -e "s#https?://assos.centrale-marseille.fr/$1#https://assos.centrale-marseille.fr/$2#g" $sql_file
-sed -i -e "s#/$1/sites/assos.centrale-marseille.fr.$1#/$2/sites/assos.centrale-marseille.fr.$2#g" $sql_file
-drush @$2 sql-drop
-drush @$2 sql-cli < $sql_file
-rm $sql_file
+current_date="$(date "+%Y-%m-%d-%Hh%Mm%Ss")"
+sql_file="${dir_tmp}/${current_date}.$1.sql"
+drush -y "@$1" sql-dump --result-file="${sql_file}"
+sed -i -e "s#https?://assos.centrale-marseille.fr/$1#https://assos.centrale-marseille.fr/$2#g" "${sql_file}"
+sed -i -e "s#/$1/sites/assos.centrale-marseille.fr.$1#/$2/sites/assos.centrale-marseille.fr.$2#g" "${sql_file}"
+drush "@$2" sql-drop
+drush "@$2" sql-cli < "${sql_file}"
+rm "${sql_file}"
 
 ## Restore file system
-if [ -n "$private_path" ] ; then
-    drush -y @$2 vset file_private_path $private_path
+if [ -n "${private_path}" ] ; then
+    drush -y "@$2" vset file_private_path "${private_path}"
 fi
-if [ -n "$public_path" ] ; then
-    drush -y @$2 vset file_public_path $public_path
+if [ -n "${public_path}" ] ; then
+    drush -y "@$2" vset file_public_path "${public_path}"
 fi
-if [ -n "$temp_path" ] ; then
-    drush -y @$2 vset file_temporary_path $temp_path
+if [ -n "${temp_path}" ] ; then
+    drush -y "@$2" vset file_temporary_path "${temp_path}"
 fi
 
 if [ "$3" = "--prod" ] ; then
-    drush -y @$2 vset maintenance_mode 0
+    drush -y "@$2" vset maintenance_mode 0
 else
-    drush -y @$2 vset maintenance_mode 1
+    drush -y "@$2" vset maintenance_mode 1
 fi
diff --git a/bin/delete-temporary-files.sh b/bin/delete-temporary-files.sh
index ab6ae1c3..270e6f2c 100755
--- a/bin/delete-temporary-files.sh
+++ b/bin/delete-temporary-files.sh
@@ -2,4 +2,4 @@
 
 . /home/assos/bin/scripts-config.sh
 
-find $dir_multi_assos -name '*~' -delete
+find "${dir_multi_assos}" -name '*~' -delete
diff --git a/bin/disk-usage.sh b/bin/disk-usage.sh
index e886e0db..d52718b9 100755
--- a/bin/disk-usage.sh
+++ b/bin/disk-usage.sh
@@ -6,18 +6,18 @@ df -h
 echo -e "\n"
 
 echo "Assos:"
-du -hcs $dir_multi_assos | grep total
+du -hcs "${dir_multi_assos}" | grep total
 echo -e "\n"
 
 echo "D7:"
-cd $d7_dir_sites
+cd "${d7_dir_sites}"
 du -h -d 1
 echo -e "\n"
 
 echo "Logs:"
-du -hcs $dir_log | grep total
+du -hcs "${dir_log}" | grep total
 echo -e "\n"
 
 echo "Backups:"
-cd $dir_backup
+cd "${dir_backup}"
 du -h -d 2
diff --git a/bin/flush-files.sh b/bin/flush-files.sh
index 96680105..90c67916 100755
--- a/bin/flush-files.sh
+++ b/bin/flush-files.sh
@@ -6,21 +6,22 @@ help="# ARGS: number of files to keep, [email address]\n
 # from the terminal."
 
 # Check if scripts-utils.sh is imported.
-if [ -z $scripts_utils ] ; then
+if [ -z "${scripts_utils}" ] ; then
     echo "Import of scripts-utils.sh required."
     . scripts-utils.sh
 fi
 
-check_arguments $# 1 "$help"
+check_arguments "$#" 1 "$help"
 
+# Must not be quoted to avoid problem with ((…))
 backups_number=$(ls | wc -l)
-let "number_of_backups_to_delete = backups_number - $1" > /dev/null
+((number_of_backups_to_delete = backups_number - $1))
 
-if [ $number_of_backups_to_delete -gt 0 ] ; then
-    ls | head -$number_of_backups_to_delete | xargs rm
+if [ "${number_of_backups_to_delete}" -gt 0 ] ; then
+    ls | head "-${number_of_backups_to_delete}" | xargs rm
 else
-    if [ ! -z $2 ] ; then
-        dir=$(pwd)
-        echo "There are not enough files in $dir to Flush it. Check if backup script works fine." | mail -s "[db] $dir has a backup problem" $2
+    if [ ! -z "$2" ] ; then
+        dir="$(pwd)"
+        echo "There are not enough files in $dir to Flush it. Check if backup script works fine." | mail -s "[db] $dir has a backup problem" "$2"
     fi
 fi
diff --git a/bin/flush-full-databases-backups.sh b/bin/flush-full-databases-backups.sh
index 3f1ce0df..c574c099 100755
--- a/bin/flush-full-databases-backups.sh
+++ b/bin/flush-full-databases-backups.sh
@@ -4,10 +4,10 @@
 
 # ARGS: Drupal version
 
-cd $dir_full_backup/$1
+cd "${dir_full_backup}/$1"
 
-for dir in $(ls) ; do
-    cd $dir
-    flush-files.sh $db_full_backup_number $email_multi_assos
+for dir in "$(ls)" ; do
+    cd "${dir}"
+    flush-files.sh "${db_full_backup_number}" "${email_multi_assos}"
     cd -
 done
diff --git a/bin/flush-individual-databases-backups.sh b/bin/flush-individual-databases-backups.sh
index ecb2248a..65a7548e 100755
--- a/bin/flush-individual-databases-backups.sh
+++ b/bin/flush-individual-databases-backups.sh
@@ -4,14 +4,14 @@
 
 # ARGS: manual or auto, Drupal version
 
-cd $dir_individual_backup/$1/$2
+cd "${dir_individual_backup}/$1/$2"
 
-for dir in $(ls) ; do
-    cd $dir
+for dir in "$(ls)" ; do
+    cd "${dir}"
     if [ $1 = 'auto' ] ; then
-        flush-files.sh $db_individual_auto_backup_number $email_multi_assos
+        flush-files.sh "${db_individual_auto_backup_number}" "${email_multi_assos}"
     else
-        flush-files.sh $db_individual_manual_backup_number
+        flush-files.sh "${db_individual_manual_backup_number}"
     fi
     cd -
 done
diff --git a/bin/scripts-config-site.sh b/bin/scripts-config-site.sh
index bc209f43..f17cf0cb 100755
--- a/bin/scripts-config-site.sh
+++ b/bin/scripts-config-site.sh
@@ -6,19 +6,19 @@
 # check_argumements is not used to avoid multiple imports
 
 # Check if scripts-config.sh is imported.
-if [ -z $scripts_config ] ; then
+if [ -z "${scripts_config}" ] ; then
     echo "Import of scripts-config.sh required."
     exit 1
 fi
 
-if [ -z $1 ] ; then
+if [ -z "$1" ] ; then
     echo "This script needs a site name as argument."
     exit 1
 fi
 
 scripts_config_site='imported'
 
-d7_site_name=$1
-d7_site_dir="$d7_dir_sites/assos.centrale-marseille.fr.$d7_site_name"
-d7_site_settings="$d7_site_dir/settings.php"
-d7_site_settings_local="$d7_site_dir/settings.local.php"
+d7_site_name="$1"
+d7_site_dir="${d7_dir_sites}/assos.centrale-marseille.fr.${d7_site_name}"
+d7_site_settings="${d7_site_dir}/settings.php"
+d7_site_settings_local="${d7_site_dir}/settings.local.php"
diff --git a/bin/scripts-config.sh b/bin/scripts-config.sh
index 76e4fc57..ce2236ac 100755
--- a/bin/scripts-config.sh
+++ b/bin/scripts-config.sh
@@ -6,7 +6,7 @@
 # *These variables must be used in scripts*
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin
-PATH=$PATH:/home/assos/bin
+PATH="$PATH":/home/assos/bin
 
 scripts_config='imported'
 
@@ -14,53 +14,53 @@ email_multi_assos="assos@centrale-marseille.fr"
 email_multi_assos_update="assos+update@centrale-marseille.fr"
 
 dir_multi_assos='/home/assos'
-dir_scripts="$dir_multi_assos/bin"
-dir_template="$dir_multi_assos/template"
-dir_private="$dir_multi_assos/private"
-dir_tmp="$dir_multi_assos/tmp"
+dir_scripts="${dir_multi_assos}/bin"
+dir_template="${dir_multi_assos}/template"
+dir_private="${dir_multi_assos}/private"
+dir_tmp="${dir_multi_assos}/tmp"
 
 ###### Aliases
 ### Bash
-. $dir_multi_assos/.aliases
+. "${dir_multi_assos}/.aliases"
 
 ### Drush
-dot_drush="$dir_multi_assos/.drush"
-aliases_drushrc_php="$dot_drush/aliases.drushrc.php"
+dot_drush="${dir_multi_assos}/.drush"
+aliases_drushrc_php="${dot_drush}/aliases.drushrc.php"
 
 ###### Database
 db_server="myassos.serv.int"
 db_user="assos"
-dir_log="$dir_multi_assos/log"
+dir_log="${dir_multi_assos}/log"
 
 ###### Backup
 db_full_backup_number=3
 db_individual_manual_backup_number=2
 db_individual_auto_backup_number=3
 
-dir_backup="$dir_multi_assos/backup"
-dir_full_backup="$dir_backup/full"
-dir_individual_backup="$dir_backup/individual"
-dir_individual_manual_backup="$dir_individual_backup/manual"
-dir_individual_auto_backup="$dir_individual_backup/auto"
+dir_backup="${dir_multi_assos}/backup"
+dir_full_backup="${dir_backup}/full"
+dir_individual_backup="${dir_backup}/individual"
+dir_individual_manual_backup="${dir_individual_backup}/manual"
+dir_individual_auto_backup="${dir_individual_backup}/auto"
 
-myassos_cnf="$dir_private/myassos.cnf"
+myassos_cnf="${dir_private}/myassos.cnf"
 
 ###### D7 variables
-d7_dir="$dir_multi_assos/drupal7"
-d7_dir_sites="$d7_dir/sites"
-sites_php="$d7_dir_sites/sites.php"
-translations_fr="$d7_dir/profiles/standard/translations/fr.po"
+d7_dir="${dir_multi_assos}/drupal7"
+d7_dir_sites="${d7_dir}/sites"
+sites_php="${d7_dir_sites}/sites.php"
+translations_fr="${d7_dir}/profiles/standard/translations/fr.po"
 
 ### Log
-d7_dir_log="$dir_log/d7"
+d7_dir_log="${dir_log}/d7"
 
 ### Backup
-d7_dir_full_backup="$dir_full_backup/d7"
-d7_dir_individual_manual_backup="$dir_individual_manual_backup/d7"
-d7_dir_individual_auto_backup="$dir_individual_auto_backup/d7"
+d7_dir_full_backup="${dir_full_backup}/d7"
+d7_dir_individual_manual_backup="${dir_individual_manual_backup}/d7"
+d7_dir_individual_auto_backup="${dir_individual_auto_backup}/d7"
 
 ### Template
 d7_settings_name="d7-settings.php"
 d7_settings_local_template_name="d7-settings-local-template.php"
-d7_settings="$dir_template/$d7_settings_name"
-d7_settings_local_template="$dir_template/$d7_settings_local_template_name"
+d7_settings="${dir_template}/${d7_settings_name}"
+d7_settings_local_template="${dir_template}/${d7_settings_local_template_name}"
diff --git a/bin/scripts-utils.sh b/bin/scripts-utils.sh
index d0e573ef..fbaf5895 100755
--- a/bin/scripts-utils.sh
+++ b/bin/scripts-utils.sh
@@ -3,7 +3,7 @@
 # This script contains useful functions for other scripts.
 
 # Check if scripts-config.sh is imported.
-if [ -z $scripts_config ] ; then
+if [ -z "${scripts_config}" ] ; then
     echo "Import of scripts-config.sh required."
     . scripts-config.sh
 fi
@@ -13,13 +13,13 @@ scripts_utils='imported'
 ask_password() {
     # read -s doesn't work with sh.
     # usage: pass=$(ask_password "password please:")
-    echo $1 >&2
+    echo "$1" >&2
     echo -n ">" >&2
     stty_avant=$(stty -g)
     stty -echo
     read password
-    stty $stty_avant
-    echo "$password"
+    stty "${stty_avant}"
+    echo "${password}"
     unset password
 }
 
@@ -29,47 +29,47 @@ generate_password() {
 
     local site_password='/'
 
-    if [ -z $1 ] ; then
+    if [ -z "$1" ] ; then
         local password_length=20
     else
-        local password_length=$1
+        local password_length="$1"
     fi
 
     while echo "$site_password" | grep -Fq '/' ; do
-        site_password=$(dd if=/dev/random count=1 | uuencode -m - | head -n 2 | tail -n 1 | cut -c-$password_length)
+        site_password="$(dd if=/dev/random count=1 | uuencode -m - | head -n 2 | tail -n 1 | cut -c-"${password_length}")"
     done
 
-    echo $site_password
+    echo "$site_password"
 }
 
 count_d7_sites() {
-    find $d7_dir_sites -type d ! -name all -maxdepth 1 | wc -l
+    find "${d7_dir_sites}" -type d ! -name all -maxdepth 1 | wc -l
 }
 
 check_arguments() {
     # ARGS: number of arguments passed to script, number of arguments required, [help text]
-    if [ $1 -lt $2  ] ; then
+    if [ "$1" -lt "$2"  ] ; then
         echo "Number of arguments insuffisant."
-	echo -e $3
+	echo -e "$3"
         exit 1
     fi
 }
 
 generate_settings_local() {
     # ARGS: site_name, site_password, d7_settings_local_template, d7_site_settings_local
-    sed "s/\%\%DBUSER\%\%/$1/ ; s/\%\%DBNAME\%\%/$1/ ; s/\%\%DBPASS\%\%/$2/ ; s/\%\%SITE_NAME\%\%/$1/" < $3 > $4
+    sed "s/\%\%DBUSER\%\%/$1/ ; s/\%\%DBNAME\%\%/$1/ ; s/\%\%DBPASS\%\%/$2/ ; s/\%\%SITE_NAME\%\%/$1/" < "$3" > "$4"
 }
 
 give_dir() {
     # ARG: file
     # Return the abosulte directory path of a file or a dir.
-    settings_location=$(realpath $1)
-    echo $(dirname $settings_location)
+    settings_location="$(realpath "$1")"
+    echo "$(dirname "${settings_location}")"
 }
 
 work_tree_clean() {
-    git_status_output=$(git status --porcelain)
-    if [ -z "$git_status_output" ] ; then
+    git_status_output="$(git status --porcelain)"
+    if [ -z "${git_status_output}" ] ; then
 	return 0
     else
 	return 1
@@ -77,16 +77,16 @@ work_tree_clean() {
 }
 
 mail_unclean_work_tree() {
-    cd $dir_multi_assos
-    git_status_output=$(git status)
-    echo "$git_status_output" | mail -s "$1" $email_multi_assos
+    cd "$dir_multi_assos"
+    git_status_output="$(git status)"
+    echo "${git_status_output}" | mail -s "$1" "${email_multi_assos}"
 }
 
 commit_if_unclean() {
     if ! work_tree_clean ; then
 	commit_message="COMMIT OF UNCLEAN STUFF"
-	commit -a -m "$commit_message"
-	mail_unclean_work_tree "[git] $commit_message"
+	commit -a -m "${commit_message}"
+	mail_unclean_work_tree "[git] ${commit_message}"
     fi
 }
 
@@ -96,21 +96,21 @@ commit() {
 	echo "Empty commit message. Nothing was commited."
 	return 2
     fi
-    cd $dir_multi_assos
+    cd "${dir_multi_assos}"
     git commit -a -m "$1"
 }
 
 site_exists() {
     # Check if site database exists.
-    if mysql --defaults-extra-file=$myassos_cnf -e "USE $1" 2>/dev/null ; then
+    if mysql --defaults-extra-file="${myassos_cnf}" -e "USE $1" 2>/dev/null ; then
 	echo "Database $1 already exits."
 	return 0
     fi
 
     # Check if site folder already exists.
-    dir=$d7_dir_sites/$1
-    if [ -d "$dir" ] ; then
-	echo "Foder $dir already exists."
+    dir="${d7_dir_sites}/$1"
+    if [ -d "${dir}" ] ; then
+	echo "Foder ${dir} already exists."
 	return 0
     fi
     return 1
diff --git a/bin/usage.sh b/bin/usage.sh
index 6da1bf37..b753b557 100755
--- a/bin/usage.sh
+++ b/bin/usage.sh
@@ -7,25 +7,25 @@ help="# ARGS: Drupal_version, project_status, project_name\n
 # List sites that have the project_name with the corresponding project_status.\n
 # project status: enabled or disabled"
 
-check_arguments $# 3 "$help"
+check_arguments "$#" 3 "${help}"
 
-if [ $1 = d7 ] ; then
-    cd $d7_dir_sites
+if [ "$1" = d7 ] ; then
+    cd "${d7_dir_sites}"
 else
     echo Unrecognize version.
 fi
 
 number_found=0
 
-for dir in $(find . -maxdepth 1 -mindepth 1 -type d ! -name all ! -name languages ! -name images | sort) ; do
+for dir in "$(find . -maxdepth 1 -mindepth 1 -type d ! -name all ! -name languages ! -name images | sort)" ; do
     # List projects that correspond to the status.
     # Keep project_name if listed.
     # Count line result. 0 if not listed or 1 if listed.
     # Print site_dir if listed.
 
-    cd $dir;
-	if [ 1 -le $(drush pml --status=$2 | grep $3 | wc -l) ] ; then
-        echo $dir;
+    cd "${dir}";
+	if [ 1 -le "$(drush pml --status="$2" | grep "$3" | wc -l)" ] ; then
+        echo "${dir}";
         number_found=$(($number_found + 1))
     fi
     cd -
diff --git a/other-scripts/d7-sync-config.example.sh b/other-scripts/d7-sync-config.example.sh
index fcd95ba1..6a510153 100644
--- a/other-scripts/d7-sync-config.example.sh
+++ b/other-scripts/d7-sync-config.example.sh
@@ -1,9 +1,9 @@
 # Example file for d7-sync.sh.  Adapt to your own needs in d7-sync-config.sh
 
-DIR_MULTIASSOS=/home/jenselme/Documents/assos/drupal
-DIR_DRUPAL7=$DIR_MULTIASSOS/drupal7
-DIR_DRUPAL7_SITES=$DIR_DRUPAL7/sites
-SITES_PHP=$DIR_DRUPAL7_SITES/sites.php
+DIR_MULTIASSOS='/home/jenselme/Documents/assos/drupal'
+DIR_DRUPAL7="${DIR_MULTIASSOS}/drupal7"
+DIR_DRUPAL7_SITES="${DIR_DRUPAL7}/sites"
+SITES_PHP="${DIR_DRUPAL7_SITES}/sites.php"
 LOCAL_BRANCH_NAME=local
 DOMAIN=assos.local
 WEBASSOS_ID=webassos
diff --git a/other-scripts/d7-sync.sh b/other-scripts/d7-sync.sh
index 73ce4ac9..0812015f 100755
--- a/other-scripts/d7-sync.sh
+++ b/other-scripts/d7-sync.sh
@@ -16,19 +16,19 @@ EOF
 ### Init
 # Config
 source d7-sync-config.sh || source d7-sync-config.example.sh
-cd $DIR_MULTIASSOS
-ret=$?
-if [ $ret -ne 0 ] ; then
+cd "${DIR_MULTIASSOS}"
+ret="$?"
+if [ "${ret}" -ne 0 ] ; then
     echo "No config file. Exiting."
     exit 2
 fi
 # git
 git checkout master
-git branch $LOCAL_BRANCH_NAME
+git branch "${LOCAL_BRANCH_NAME}"
 
 ### sync drupal tree
 git pull --rebase
-git checkout $LOCAL_BRANCH_NAME
+git checkout "${LOCAL_BRANCH_NAME}"
 # Auto solve conflicts: it takes the version from master in case of conflict.
 git rebase master --strategy-option ours
 
@@ -37,22 +37,22 @@ if [ -z "$1" ] ; then
     exit 0
 fi
 
-cd $DIR_DRUPAL7_SITES
+cd "${DIR_DRUPAL7_SITES}"
 
 # Some variables are different for default
-if [ $1 = default ] ; then
-    dir_site=$1
-    base_url=http://$DOMAIN
+if [ "$1" = default ] ; then
+    dir_site="$1"
+    base_url="http://${DOMAIN}"
     local_db_name=assos_default
 else
-    dir_site=assos.centrale-marseille.fr.$1
-    base_url=http://$DOMAIN/$1
-    local_db_name=$1
+    dir_site="assos.centrale-marseille.fr.$1"
+    base_url="http://${DOMAIN}/$1"
+    local_db_name="$1"
 fi
 
-mkdir $dir_site
-cd $dir_site
-rsync -rltp --progress --delete $WEBASSOS_ID:drupal7/sites/$dir_site/ .
+mkdir "${dir_site}"
+cd "${dir_site}"
+rsync -rltp --progress --delete "${WEBASSOS_ID}:drupal7/sites/${dir_site}/" .
 # Change permissions for Apache
 # TODO: do something less permissive than 755
 chmod -R 755 .
@@ -60,36 +60,36 @@ chmod -R 777 files
 
 
 ### sync databases
-now=$(date +%s)
-sql_file="$1.$now.sql"
-remote_sql_file="$REMOTE_DIR_TMP_SAS/$sql_file"
-ssh $WEBASSOS_ID "drush @$1 sql-dump > $remote_sql_file"
-scp $WEBASSOS_ID:$remote_sql_file .
+now="$(date +%s)"
+sql_file="$1.${now}.sql"
+remote_sql_file="${REMOTE_DIR_TMP_SAS}/${sql_file}"
+ssh "${WEBASSOS_ID}" "drush @$1 sql-dump > ${remote_sql_file}"
+scp "${WEBASSOS_ID}:${remote_sql_file}" .
 mysql -u root -e "DROP DATABASE IF EXISTS $local_db_name; CREATE DATABASE $local_db_name"
-ret=$?
-if [ $ret -ne 0 ] ; then
+ret="$?"
+if [ "${ret}" -ne 0 ] ; then
     echo "mysql daemon is not started. Exiting."
     assos "rm $remote_sql_file"
-    rm $sql_file
+    rm "${sql_file}"
     exit 1
 fi
-mysql -u root $local_db_name < $sql_file
-rm $sql_file
-ssh $WEBASSOS_ID "rm $remote_sql_file"
+mysql -u root "${local_db_name}" < "${sql_file}"
+rm "${sql_file}"
+ssh "${WEBASSOS_ID}" "rm ${remote_sql_file}"
 
 ### modify settings.php
-python3 $DIR_MULTIASSOS/other-scripts/modify-settings.py settings.local.php --baseurl $base_url --database $local_db_name
+python3 "${DIR_MULTIASSOS}/other-scripts/modify-settings.py" "settings.local.php" --baseurl "${base_url}" --database "${local_db_name}"
 chmod 666 *.php
 
 ### Modify sites.php
-sed "s/\['assos.centrale-marseille.fr[a-b1-9]*/['$DOMAIN/g" < $SITES_PHP > $SITES_PHP.tmp
-mv $SITES_PHP.tmp $SITES_PHP
+sed "s/\['assos.centrale-marseille.fr[a-b1-9]*/['$DOMAIN/g" < "${SITES_PHP}" > "${SITES_PHP}.tmp"
+mv "${SITES_PHP}.tmp" "${SITES_PHP}"
 git commit -a -m "Modify sites.php"
 
 ### various drush cmd to finish synchronisation
 drush status > /dev/null
-ret=$?
-if [ $ret -ne 0 ] ; then
+ret="$?"
+if [ "$ret" -ne 0 ] ; then
     echo "drush or site has a problem. Exiting."
     exit 1
 fi
