Przeglądaj źródła

Cleanup of various things identified by shellcheck

CedarLUG 8 lat temu
rodzic
commit
6667a86de7
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      lgsm/functions/command_backup.sh

+ 4 - 4
lgsm/functions/command_backup.sh

@@ -210,19 +210,19 @@ fn_backup_relpath() {
 
 
 	# Compare the leading entries of each array.  These common elements will be clipped off
 	# Compare the leading entries of each array.  These common elements will be clipped off
 	# for the relative path output.
 	# for the relative path output.
-  	for ((base=0; $base<${#rdirtoks[@]}; base++))
+  	for ((base=0; base<${#rdirtoks[@]}; base++))
   	do
   	do
       		[[ "${rdirtoks[$base]}" != "${bdirtoks[$base]}" ]] && break
       		[[ "${rdirtoks[$base]}" != "${bdirtoks[$base]}" ]] && break
   	done
   	done
 
 
 	# Next, climb out of the remaining rootdir location with updir references...
 	# Next, climb out of the remaining rootdir location with updir references...
-  	for ((x=${base};$x<${#rdirtoks[@]};x++))
+  	for ((x=base;x<${#rdirtoks[@]};x++))
   	do
   	do
       		echo -n "../"
       		echo -n "../"
   	done
   	done
 
 
 	# Climb down the remaining components of the backupdir location.
 	# Climb down the remaining components of the backupdir location.
-  	for ((x=${base};$x<$(( ${#bdirtoks[@]} - 1 ));x++))
+  	for ((x=base;x<$(( ${#bdirtoks[@]} - 1 ));x++))
   	do
   	do
       		echo -n "${bdirtoks[$x]}/"
       		echo -n "${bdirtoks[$x]}/"
   	done
   	done
@@ -231,7 +231,7 @@ fn_backup_relpath() {
 	# traverse down, just add a newline.  Otherwise at this point, there is
 	# traverse down, just add a newline.  Otherwise at this point, there is
 	# one remaining directory component in the backupdir to navigate.
 	# one remaining directory component in the backupdir to navigate.
   	if (( "$base" < "${#bdirtoks[@]}" )) ; then
   	if (( "$base" < "${#bdirtoks[@]}" )) ; then
-      		echo ${bdirtoks[ $(( ${#bdirtoks[@]} - 1)) ]}
+      		echo "${bdirtoks[ $(( ${#bdirtoks[@]} - 1)) ]}"
   	else
   	else
       		echo
       		echo
   	fi
   	fi