commit 8550e097b570cc7f91a4d168e43001cb2cb11092
Author: Julien Enselme <julien.enselme@centrale-marseille.fr>
Date:   Wed Oct 15 15:45:42 2014 +0200

    Command subsitution are not quoted. Quotes posed problems in loop.

diff --git a/bin/all-reset-permissions.sh b/bin/all-reset-permissions.sh
index 950afc3c..0dd3faf6 100755
--- a/bin/all-reset-permissions.sh
+++ b/bin/all-reset-permissions.sh
@@ -5,7 +5,7 @@
 # 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
+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"
diff --git a/bin/d7-all-drush.sh b/bin/d7-all-drush.sh
index 49f0f0f4..3b3aa61b 100755
--- a/bin/d7-all-drush.sh
+++ b/bin/d7-all-drush.sh
@@ -7,7 +7,7 @@ help="# ARGS: drush_command"
 
 check_arguments "$#" 1 "${help}"
 
-for dir in "$(find "${d7_dir_sites}" -maxdepth 1 -mindepth 1 -type d ! -name all | sort)" ; do
+for dir in $(find "${d7_dir_sites}" -maxdepth 1 -mindepth 1 -type d ! -name all | sort) ; do
     cd "${dir}"
     echo "${dir}"
     drush "$@"
diff --git a/bin/d7-all-dump-full.sh b/bin/d7-all-dump-full.sh
index 5c4bd778..0c176156 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"
diff --git a/bin/d7-all-dump-individual.sh b/bin/d7-all-dump-individual.sh
index 2d51eedd..0db5fe91 100755
--- a/bin/d7-all-dump-individual.sh
+++ b/bin/d7-all-dump-individual.sh
@@ -7,11 +7,11 @@ help="# ARGS: auto or manual"
 
 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}"
 
-for dir in "$(find . -maxdepth 1 -mindepth 1 -type d ! -name all | cut -c3-)" ; do
+for dir in $(find . -maxdepth 1 -mindepth 1 -type d ! -name all | cut -c3-); do
     cd "${dir}"
     drush cc all
     if [ "$1" = 'auto' ] ; then
diff --git a/bin/d7-all-releases-info.sh b/bin/d7-all-releases-info.sh
index 39e4ce0f..36f82375 100755
--- a/bin/d7-all-releases-info.sh
+++ b/bin/d7-all-releases-info.sh
@@ -7,7 +7,7 @@
 
 # modules
 cd "${d7_dir_sites}/all/modules"
-for dir in "$(ls -1)" ; do
+for dir in $(ls -1) ; do
     if [ -d "${dir}" ] ; then
         drush pm-releases "${dir}"
     fi
@@ -15,7 +15,7 @@ done
 
 # themes
 cd "${d7_dir_sites}/all/themes"
-for dir in "$(ls -1)" ; do
+for dir in $(ls -1) ; do
     if [ -d "${dir}" ] ; then
         drush pm-releases "${dir}"
     fi
diff --git a/bin/d7-all-reset-variables.sh b/bin/d7-all-reset-variables.sh
index 5d2e8cff..54d82d7c 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
+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)"
+    site_name=$(echo "${dir}" | tr '.' '\n' | tail -n 1)
     d7-reset-variables.sh "${site_name}"
 done
diff --git a/bin/d7-all-update-core.sh b/bin/d7-all-update-core.sh
index 61e33e57..89aa51f4 100755
--- a/bin/d7-all-update-core.sh
+++ b/bin/d7-all-update-core.sh
@@ -30,7 +30,7 @@ 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
diff --git a/bin/d7-all-update-settings.sh b/bin/d7-all-update-settings.sh
index 8e3704db..46e184bc 100755
--- a/bin/d7-all-update-settings.sh
+++ b/bin/d7-all-update-settings.sh
@@ -5,10 +5,10 @@
 
 # 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}")"
+    settings_dir=$(give_dir "${settings}")
     cd "${settings_dir}"
 
     chmod 700 "${settings}"
diff --git a/bin/d7-all-usage.sh b/bin/d7-all-usage.sh
index 7b67dc16..53a77bf2 100755
--- a/bin/d7-all-usage.sh
+++ b/bin/d7-all-usage.sh
@@ -6,7 +6,7 @@
 
 cd "${d7_dir_sites}"
 
-for line in "$(drush pml --no-core --pipe)"; do
+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 af32189e..5b8cfcad 100755
--- a/bin/d7-create-site.sh
+++ b/bin/d7-create-site.sh
@@ -26,13 +26,13 @@ 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
@@ -45,7 +45,7 @@ fi
 
 ###### Initialisation
 cd "${d7_dir}"
-site_password="$(generate_password)"
+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
@@ -60,7 +60,7 @@ 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")"
+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"
diff --git a/bin/d7-reset-variables.sh b/bin/d7-reset-variables.sh
index 3e0facdd..2585c1df 100755
--- a/bin/d7-reset-variables.sh
+++ b/bin/d7-reset-variables.sh
@@ -14,10 +14,10 @@ if [ -n "$1" ] ; then
     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
diff --git a/bin/d7-sync-site.sh b/bin/d7-sync-site.sh
index d0fcfcb9..9ddd08ef 100755
--- a/bin/d7-sync-site.sh
+++ b/bin/d7-sync-site.sh
@@ -27,7 +27,7 @@ fi
 
 
 # Backup the database of SOURCE_SITE
-current_date="$(date "+%Y-%m-%d-%Hh%Mm%Ss")"
+current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
 if [ "$1" = "default" ] ; then
     dir="$2"
 else
@@ -45,13 +45,13 @@ 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)"
+    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")"
+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}"
diff --git a/bin/flush-files.sh b/bin/flush-files.sh
index 90c67916..a54045e1 100755
--- a/bin/flush-files.sh
+++ b/bin/flush-files.sh
@@ -21,7 +21,7 @@ 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)"
+        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 c574c099..7964d5b6 100755
--- a/bin/flush-full-databases-backups.sh
+++ b/bin/flush-full-databases-backups.sh
@@ -6,7 +6,7 @@
 
 cd "${dir_full_backup}/$1"
 
-for dir in "$(ls)" ; do
+for dir in $(ls) ; do
     cd "${dir}"
     flush-files.sh "${db_full_backup_number}" "${email_multi_assos}"
     cd -
diff --git a/bin/flush-individual-databases-backups.sh b/bin/flush-individual-databases-backups.sh
index 65a7548e..207abb25 100755
--- a/bin/flush-individual-databases-backups.sh
+++ b/bin/flush-individual-databases-backups.sh
@@ -6,9 +6,9 @@
 
 cd "${dir_individual_backup}/$1/$2"
 
-for dir in "$(ls)" ; do
+for dir in $(ls) ; do
     cd "${dir}"
-    if [ $1 = 'auto' ] ; then
+    if [ "$1" = 'auto' ] ; then
         flush-files.sh "${db_individual_auto_backup_number}" "${email_multi_assos}"
     else
         flush-files.sh "${db_individual_manual_backup_number}"
diff --git a/bin/scripts-utils.sh b/bin/scripts-utils.sh
index fbaf5895..1d507f2f 100755
--- a/bin/scripts-utils.sh
+++ b/bin/scripts-utils.sh
@@ -36,7 +36,7 @@ generate_password() {
     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"
@@ -63,12 +63,12 @@ generate_settings_local() {
 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)"
+    git_status_output=$(git status --porcelain)
     if [ -z "${git_status_output}" ] ; then
 	return 0
     else
@@ -77,8 +77,8 @@ work_tree_clean() {
 }
 
 mail_unclean_work_tree() {
-    cd "$dir_multi_assos"
-    git_status_output="$(git status)"
+    cd "${dir_multi_assos}"
+    git_status_output=$(git status)
     echo "${git_status_output}" | mail -s "$1" "${email_multi_assos}"
 }
 
diff --git a/bin/usage.sh b/bin/usage.sh
index b753b557..f88fbc79 100755
--- a/bin/usage.sh
+++ b/bin/usage.sh
@@ -17,14 +17,14 @@ 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
+	if [ 1 -le $(drush pml --status="$2" | grep "$3" | wc -l) ] ; then
         echo "${dir}";
         number_found=$(($number_found + 1))
     fi
diff --git a/other-scripts/d7-sync.sh b/other-scripts/d7-sync.sh
index 0812015f..ad88dd02 100755
--- a/other-scripts/d7-sync.sh
+++ b/other-scripts/d7-sync.sh
@@ -60,7 +60,7 @@ chmod -R 777 files
 
 
 ### sync databases
-now="$(date +%s)"
+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}"
