Skip to content

Commit 16cf14c

Browse files
committed
Fix error SC2068 in shell scripts
Fix SC2068 (error): Double quote array expansions to avoid re-splitting elements. https://www.shellcheck.net/wiki/SC2068
1 parent 5c32309 commit 16cf14c

File tree

10 files changed

+15
-15
lines changed

10 files changed

+15
-15
lines changed

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ while [[ -h $source ]]; do
1313
done
1414

1515
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
16-
"$scriptroot/eng/common/build.sh" --build --restore $@
16+
"$scriptroot/eng/common/build.sh" --build --restore "$@"

eng/common/SetupNugetSources.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fi
164164

165165
DotNetVersions=('5' '6' '7' '8' '9' '10')
166166

167-
for DotNetVersion in ${DotNetVersions[@]} ; do
167+
for DotNetVersion in "${DotNetVersions[@]}" ; do
168168
FeedPrefix="dotnet${DotNetVersion}";
169169
grep -i "<add key=\"$FeedPrefix\"" $ConfigFile > /dev/null
170170
if [ "$?" == "0" ]; then
@@ -181,7 +181,7 @@ PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"')
181181
IFS=$PrevIFS
182182

183183
if [ "$CredToken" ]; then
184-
for FeedName in ${PackageSources[@]} ; do
184+
for FeedName in "${PackageSources[@]}" ; do
185185
# Check if there is no existing credential for this FeedName
186186
grep -i "<$FeedName>" $ConfigFile
187187
if [ "$?" != "0" ]; then

eng/common/cibuild.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ while [[ -h $source ]]; do
1313
done
1414
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
1515

16-
. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@
16+
. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci "$@"

eng/common/cross/tizen-fetch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88
Log()
99
{
1010
if [ $VERBOSE -ge 1 ]; then
11-
echo ${@:2}
11+
echo "${@:2}"
1212
fi
1313
}
1414

@@ -127,7 +127,7 @@ fetch_tizen_pkgs()
127127

128128
PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())'
129129

130-
for pkg in ${@:2}
130+
for pkg in "${@:2}"
131131
do
132132
Inform "Fetching... $pkg"
133133
XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg}

eng/common/pipeline-logging-functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function Write-PipelineTelemetryError {
3636
fi
3737
message="(NETCORE_ENGINEERING_TELEMETRY=$telemetry_category) $message"
3838
function_args+=("$message")
39-
Write-PipelineTaskError ${function_args[@]}
39+
Write-PipelineTaskError "${function_args[@]}"
4040
}
4141

4242
function Write-PipelineTaskError {

eng/configure-toolset.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Test-FilesUseTelemetryOutput {
2121

2222
local file_list=`grep --files-without-match --recursive --include=*.sh "Write-PipelineTelemetryError" $scriptroot`
2323
for file in $file_list; do
24-
for remove_file in ${require_telemetry_exclude_files[@]}; do
24+
for remove_file in "${require_telemetry_exclude_files[@]}"; do
2525
if [[ $file =~ .*"$remove_file" ]]; then
2626
file_list=( "${file_list[@]/$file}" )
2727
fi

restore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ while [[ -h $source ]]; do
1313
done
1414

1515
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
16-
"$scriptroot/eng/common/build.sh" --restore $@
16+
"$scriptroot/eng/common/build.sh" --restore "$@"

src/Microsoft.DotNet.Build.Tasks.Installers/build/deb-package-tool/package_tool.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ package_absolute_placement(){
186186
abs_files=( $(_get_files_in_dir_tree $ABSOLUTE_PLACEMENT_DIR) )
187187

188188
# For each file add a a system placement
189-
for abs_file in ${abs_files[@]}
189+
for abs_file in "${abs_files[@]}"
190190
do
191191
parent_dir=$(dirname $abs_file)
192192
filename=$(basename $abs_file)
@@ -241,7 +241,7 @@ generate_manpage_manifest(){
241241
# Remove any existing manifest
242242
rm -f ${DEBIAN_DIR}/${PACKAGE_NAME}.manpages
243243

244-
for manpage in ${generated_manpages[@]}
244+
for manpage in "${generated_manpages[@]}"
245245
do
246246
echo "${docs_rel_path}/${manpage}" >> "${DEBIAN_DIR}/${PACKAGE_NAME}.manpages"
247247
done
@@ -252,7 +252,7 @@ generate_sample_manifest(){
252252
generated_manpages=( $(_get_files_in_dir_tree $INPUT_SAMPLES_DIR) )
253253

254254
rm -f sample_manifest
255-
for sample in ${samples[@]}
255+
for sample in "${samples[@]}"
256256
do
257257
echo "$sample" >> "${DEBIAN_DIR}/${PACKAGE_NAME}.examples"
258258
done

src/Microsoft.DotNet.Build.Tasks.Installers/build/deb-package-tool/scripts/debian_build_lib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ add_system_dir_placement(){
5151
in_package_dir="${in_package_dir}/"
5252
fi
5353

54-
for rel_filepath in ${dir_files[@]}
54+
for rel_filepath in "${dir_files[@]}"
5555
do
5656
local parent_path=$(dirname $rel_filepath)
5757

@@ -122,7 +122,7 @@ _copy_files_to_package(){
122122
shift; shift;
123123
rel_filepath_list=( $@ )
124124

125-
for rel_filepath in ${rel_filepath_list[@]}
125+
for rel_filepath in "${rel_filepath_list[@]}"
126126
do
127127
local parent_dir=$(dirname $rel_filepath)
128128
local filename=$(basename $rel_filepath)

test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ while [[ -h $source ]]; do
1313
done
1414

1515
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
16-
"$scriptroot/eng/common/build.sh" --test $@
16+
"$scriptroot/eng/common/build.sh" --test "$@"

0 commit comments

Comments
 (0)