Skip to content

Commit 686da4d

Browse files
committed
fix: use shell best practices
1 parent e758486 commit 686da4d

File tree

1 file changed

+7
-7
lines changed
  • sdk-platform-java/hermetic_build/library_generation/utils

1 file changed

+7
-7
lines changed

sdk-platform-java/hermetic_build/library_generation/utils/utilities.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,14 @@ error_if_not_exists() {
335335
}
336336

337337
normalize_owlbot_yaml() {
338-
local input_file=$1
339-
local output_file=$2
340-
local library_name=$3
338+
local input_file="$1"
339+
local output_file="$2"
340+
local library_name="$3"
341341

342342
# Step 1: Remove library name prefix and normalize indentation for matching lines.
343343
# Step 2: Normalize indentation for lines that didn't have the prefix.
344-
cat "${input_file}" \
345-
| sed -e "s/^[[:space:]]*- \"\/${library_name}/- \"/" \
346-
-e "s/^[[:space:]]*- \"/- \"/" \
347-
> "${output_file}"
344+
# Using | as sed delimiter to avoid escaping forward slashes.
345+
sed -e "s|^\s*- \"/${library_name}|- \"|" \
346+
-e "s|^\s*- \"|- \"|" \
347+
"${input_file}" > "${output_file}"
348348
}

0 commit comments

Comments
 (0)