Skip to content

Commit 26550a6

Browse files
Add a space after redirect ops in shell script
1 parent 95f66af commit 26550a6

5 files changed

Lines changed: 36 additions & 36 deletions

File tree

functions.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function get_variants() {
6262

6363
arch=$(get_arch)
6464
variantsfilter=("$@")
65-
IFS=' ' read -ra availablevariants <<<"$(grep "^${arch}" "${dir}/architectures" | sed -E 's/'"${arch}"'[[:space:]]*//' | sed -E 's/,/ /g')"
65+
IFS=' ' read -ra availablevariants <<< "$(grep "^${arch}" "${dir}/architectures" | sed -E 's/'"${arch}"'[[:space:]]*//' | sed -E 's/,/ /g')"
6666

6767
if [ ${#variantsfilter[@]} -gt 0 ]; then
6868
for variant1 in "${availablevariants[@]}"; do
@@ -100,16 +100,16 @@ function get_supported_arches() {
100100
shift
101101

102102
# Get default supported arches
103-
lines=$(grep "${variant}" "$(dirname "${version}")"/architectures 2>/dev/null | cut -d' ' -f1)
103+
lines=$(grep "${variant}" "$(dirname "${version}")"/architectures 2> /dev/null | cut -d' ' -f1)
104104

105105
# Get version specific supported architectures if there is specialized information
106106
if [ -a "${version}"/architectures ]; then
107-
lines=$(grep "${variant}" "${version}"/architectures 2>/dev/null | cut -d' ' -f1)
107+
lines=$(grep "${variant}" "${version}"/architectures 2> /dev/null | cut -d' ' -f1)
108108
fi
109109

110110
while IFS='' read -r line; do
111111
arches+=("${line}")
112-
done <<<"${lines}"
112+
done <<< "${lines}"
113113

114114
echo "${arches[@]}"
115115
}
@@ -149,13 +149,13 @@ function get_versions() {
149149
local default_variant
150150
default_variant=$(get_config "./" "default_variant")
151151
if [ ${#dirs[@]} -eq 0 ]; then
152-
IFS=' ' read -ra dirs <<<"$(echo "${prefix%/}/"*/)"
152+
IFS=' ' read -ra dirs <<< "$(echo "${prefix%/}/"*/)"
153153
fi
154154

155155
for dir in "${dirs[@]}"; do
156156
if [ -a "${dir}/config" ]; then
157157
local subdirs
158-
IFS=' ' read -ra subdirs <<<"$(get_versions "${dir#./}")"
158+
IFS=' ' read -ra subdirs <<< "$(get_versions "${dir#./}")"
159159
for subdir in "${subdirs[@]}"; do
160160
versions+=("${subdir}")
161161
done
@@ -174,7 +174,7 @@ function get_fork_name() {
174174
version=$1
175175
shift
176176

177-
IFS='/' read -ra versionparts <<<"${version}"
177+
IFS='/' read -ra versionparts <<< "${version}"
178178
if [ ${#versionparts[@]} -gt 1 ]; then
179179
echo "${versionparts[0]}"
180180
fi
@@ -260,7 +260,7 @@ function get_tag() {
260260
fi
261261

262262
local tagparts
263-
IFS=' ' read -ra tagparts <<<"$(get_fork_name "${version}") ${tagversion}"
263+
IFS=' ' read -ra tagparts <<< "$(get_fork_name "${version}") ${tagversion}"
264264
IFS='-'
265265
echo "${tagparts[*]}"
266266
unset IFS
@@ -278,11 +278,11 @@ function sort_versions() {
278278

279279
while IFS='' read -r line; do
280280
sorted+=("${line}")
281-
done <<<"$(echo "${lines}" | grep "^[0-9]" | sort -r)"
281+
done <<< "$(echo "${lines}" | grep "^[0-9]" | sort -r)"
282282

283283
while IFS='' read -r line; do
284284
sorted+=("${line}")
285-
done <<<"$(echo "${lines}" | grep -v "^[0-9]" | sort -r)"
285+
done <<< "$(echo "${lines}" | grep -v "^[0-9]" | sort -r)"
286286

287287
echo "${sorted[@]}"
288288
}
@@ -312,7 +312,7 @@ function images_updated() {
312312

313313
commit_range="$(commit_range "$@")"
314314

315-
IFS=' ' read -ra versions <<<"$(
315+
IFS=' ' read -ra versions <<< "$(
316316
IFS=','
317317
get_versions
318318
)"

generate-stackbrew-library.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44
. functions.sh
55

6-
hash git 2>/dev/null || { echo >&2 "git not found, exiting."; }
6+
hash git 2> /dev/null || { echo >&2 "git not found, exiting."; }
77

88
# Used dynamically: print "$array_" $1
99
# shellcheck disable=SC2034
@@ -23,8 +23,8 @@ cd "$(cd "${0%/*}" && pwd -P)"
2323

2424
self="$(basename "${BASH_SOURCE[0]}")"
2525

26-
IFS=' ' read -ra versions <<<"$(get_versions)"
27-
IFS=' ' read -ra versions <<<"$(sort_versions "${versions[@]}")"
26+
IFS=' ' read -ra versions <<< "$(get_versions)"
27+
IFS=' ' read -ra versions <<< "$(sort_versions "${versions[@]}")"
2828
url='https://github.com/nodejs/docker-node'
2929

3030
# get the most recent commit which modified any of "$@"
@@ -50,7 +50,7 @@ join() {
5050
get_stub() {
5151
local version="${1}"
5252
shift
53-
IFS='/' read -ra versionparts <<<"${version}"
53+
IFS='/' read -ra versionparts <<< "${version}"
5454
local stub
5555
eval stub="$(join '_' "${versionparts[@]}" | awk -F. '{ print "$array_" $1 }')"
5656
echo "${stub}"
@@ -65,11 +65,11 @@ for version in "${versions[@]}"; do
6565
fullVersion="$(get_tag "${version}" full)"
6666
majorMinorVersion="$(get_tag "${version}" majorminor)"
6767

68-
IFS=' ' read -ra versionAliases <<<"$fullVersion $majorMinorVersion $stub"
68+
IFS=' ' read -ra versionAliases <<< "$fullVersion $majorMinorVersion $stub"
6969

7070
if [ -f "${version}/Dockerfile" ]; then
7171
# Get supported architectures for a specific version. See details in function.sh
72-
IFS=' ' read -ra supportedArches <<<"$(get_supported_arches "${version}" "default")"
72+
IFS=' ' read -ra supportedArches <<< "$(get_supported_arches "${version}" "default")"
7373

7474
echo "Tags: $(join ', ' "${versionAliases[@]}")"
7575
echo "Architectures: $(join ', ' "${supportedArches[@]}")"
@@ -80,7 +80,7 @@ for version in "${versions[@]}"; do
8080

8181
# Get supported variants according to the target architecture.
8282
# See details in function.sh
83-
IFS=' ' read -ra variants <<<"$(get_variants "$(dirname "${version}")")"
83+
IFS=' ' read -ra variants <<< "$(get_variants "$(dirname "${version}")")"
8484
for variant in "${variants[@]}"; do
8585
# Skip non-docker directories
8686
[ -f "${version}/${variant}/Dockerfile" ] || continue
@@ -96,7 +96,7 @@ for version in "${versions[@]}"; do
9696

9797
# Get supported architectures for a specific version and variant.
9898
# See details in function.sh
99-
IFS=' ' read -ra supportedArches <<<"$(get_supported_arches "${version}" "${variant}")"
99+
IFS=' ' read -ra supportedArches <<< "$(get_supported_arches "${version}" "${variant}")"
100100

101101
echo "Tags: $(join ', ' "${variantAliases[@]}")"
102102
echo "Architectures: $(join ', ' "${supportedArches[@]}")"

generate-stackbrew-pr.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ if images_updated "${COMMIT_ID}"; then
9696
setup_git_author
9797

9898
info "Cloning..."
99-
git clone --depth 50 "https://github.com/${UPSTREAM_SLUG}.git" ${gitpath} 2>/dev/null
99+
git clone --depth 50 "https://github.com/${UPSTREAM_SLUG}.git" ${gitpath} 2> /dev/null
100100

101101
stackbrew="$(./generate-stackbrew-library.sh)"
102102

103103
cd ${gitpath}
104104

105-
echo "${stackbrew}" >"${IMAGES_FILE}"
105+
echo "${stackbrew}" > "${IMAGES_FILE}"
106106
git checkout -b "${BRANCH_NAME}"
107107
git add "${IMAGES_FILE}"
108108
git commit -m "$(message)"
109109

110110
info "Pushing..."
111-
git push "https://${GITHUB_API_TOKEN}:[email protected]/${ORIGIN_SLUG}.git" -f "${BRANCH_NAME}" 2>/dev/null || fatal "Error pushing the updated stackbrew"
111+
git push "https://${GITHUB_API_TOKEN}:[email protected]/${ORIGIN_SLUG}.git" -f "${BRANCH_NAME}" 2> /dev/null || fatal "Error pushing the updated stackbrew"
112112

113113
cd - && rm -rf ${gitpath}
114114

test-build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ set -euo pipefail
99
# Convert comma delimited cli arguments to arrays
1010
# E.g. ./test-build.sh 8,10 slim,onbuild
1111
# "8,10" becomes "8 10" and "slim,onbuild" becomes "slim onbuild"
12-
IFS=',' read -ra versions_arg <<<"${1:-}"
13-
IFS=',' read -ra variant_arg <<<"${2:-}"
12+
IFS=',' read -ra versions_arg <<< "${1:-}"
13+
IFS=',' read -ra variant_arg <<< "${2:-}"
1414

1515
default_variant=$(get_config "./" "default_variant")
1616

@@ -62,7 +62,7 @@ function test_image() {
6262

6363
cd "$(cd "${0%/*}" && pwd -P)" || exit
6464

65-
IFS=' ' read -ra versions <<<"$(get_versions . "${versions_arg[@]}")"
65+
IFS=' ' read -ra versions <<< "$(get_versions . "${versions_arg[@]}")"
6666
if [ ${#versions[@]} -eq 0 ]; then
6767
fatal "No valid versions found!"
6868
fi
@@ -82,7 +82,7 @@ for version in "${versions[@]}"; do
8282

8383
# Get supported variants according to the target architecture.
8484
# See details in function.sh
85-
IFS=' ' read -ra variants <<<"$(get_variants "$(dirname "${version}")" "${variant_arg[@]}")"
85+
IFS=' ' read -ra variants <<< "$(get_variants "$(dirname "${version}")" "${variant_arg[@]}")"
8686

8787
for variant in "${variants[@]}"; do
8888
# Skip non-docker directories

update.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -ue
33

44
function usage() {
5-
cat <<EOF
5+
cat << EOF
66
77
Update the node docker images.
88
@@ -47,12 +47,12 @@ done
4747

4848
cd "$(cd "${0%/*}" && pwd -P)"
4949

50-
IFS=',' read -ra versions_arg <<<"${1:-}"
51-
IFS=',' read -ra variant_arg <<<"${2:-}"
50+
IFS=',' read -ra versions_arg <<< "${1:-}"
51+
IFS=',' read -ra variant_arg <<< "${2:-}"
5252

53-
IFS=' ' read -ra versions <<<"$(get_versions .)"
54-
IFS=' ' read -ra update_versions <<<"$(get_versions . "${versions_arg[@]:-}")"
55-
IFS=' ' read -ra update_variants <<<"$(get_variants . "${variant_arg[@]:-}")"
53+
IFS=' ' read -ra versions <<< "$(get_versions .)"
54+
IFS=' ' read -ra update_versions <<< "$(get_versions . "${versions_arg[@]:-}")"
55+
IFS=' ' read -ra update_variants <<< "$(get_variants . "${variant_arg[@]:-}")"
5656
if [ ${#versions[@]} -eq 0 ]; then
5757
fatal "No valid versions found!"
5858
fi
@@ -151,7 +151,7 @@ function update_node_version() {
151151
while read -r line; do
152152
pattern='"\$\{'$(echo "${key_type}" | tr '[:lower:]' '[:upper:]')'_KEYS\[@\]\}"'
153153
sed -Ei -e "s/([ \\t]*)(${pattern})/\\1${line}${new_line}\\1\\2/" "${dockerfile}-tmp"
154-
done <"keys/${key_type}.keys"
154+
done < "keys/${key_type}.keys"
155155
sed -Ei -e "/${pattern}/d" "${dockerfile}-tmp"
156156
done
157157

@@ -183,11 +183,11 @@ function add_stage() {
183183
- stage: Build
184184
env:
185185
- NODE_VERSION: "'"${version}"'"
186-
- VARIANT: "'"${variant}"'"' >>.travis.yml
186+
- VARIANT: "'"${variant}"'"' >> .travis.yml
187187
}
188188

189189
echo '#### DO NOT MODIFY. THIS FILE IS AUTOGENERATED ####
190-
' | cat - travis.yml.template >.travis.yml
190+
' | cat - travis.yml.template > .travis.yml
191191

192192
for version in "${versions[@]}"; do
193193
parentpath=$(dirname "${version}")
@@ -199,7 +199,7 @@ for version in "${versions[@]}"; do
199199

200200
# Get supported variants according the target architecture
201201
# See details in function.sh
202-
IFS=' ' read -ra variants <<<"$(get_variants "${parentpath}")"
202+
IFS=' ' read -ra variants <<< "$(get_variants "${parentpath}")"
203203

204204
if [ -f "${version}/Dockerfile" ]; then
205205
add_stage "${baseuri}" "${version}" "default"

0 commit comments

Comments
 (0)