[X2Go-Commits] [x2goclient] 62/281: deduplicate.sh: change range-based for loops to "${!arr[@]}" to handle "sparse" arrays correctly.

git-admin at x2go.org git-admin at x2go.org
Thu Jan 19 13:04:50 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 04f90b6e4af757d603634fec99a46d3067bb89bc
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Aug 27 04:48:32 2015 +0200

    deduplicate.sh: change range-based for loops to "${!arr[@]}" to handle "sparse" arrays correctly.
---
 debian/changelog |    2 ++
 deduplicate.sh   |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0b0ae72..583c540 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -141,6 +141,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
     - deduplicate.sh: add first skeleton for library dependency rewriting of
       deleted duplicates.
     - deduplicate.sh: correctly unset an array element.
+    - deduplicate.sh: change range-based for loops to "${!arr[@]}" to handle
+      "sparse" arrays correctly.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/deduplicate.sh b/deduplicate.sh
index b7d066a..d932fbb 100755
--- a/deduplicate.sh
+++ b/deduplicate.sh
@@ -70,7 +70,7 @@ for entry in ${duplicates[@]}; do
 done
 
 typeset -i i="0"
-for ((i = 0; i < ${#duplicates[@]}; ++i)); do
+for i in "${!duplicates[@]}"; do
 	entry="${duplicates[${i}]}"
 	typeset special_file_regex=""
 	for special_file_regex in ${special_files_regex[@]}; do
@@ -91,7 +91,7 @@ done
 for entry in ${duplicates[@]}; do
 	echo "rm -v ${base_dir}/${entry}"
 	typeset -i i="0"
-	for ((i = 0; i < ${#all_files[@]}; ++i)); do
+	for i in "${!all_files[@]}"; do
 		typeset all_entry="${all_files[${i}]}"
 		typeset relative_path="${all_entry##"${base_dir}/"}"
 		if [ "${relative_path}" = "${entry}" ]; then

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list