Skip to content

Commit 99b8501

Browse files
authored
Merge pull request #156 from jump-cellpainting/update_etags_portable
fix: jq quotes + avoid xargs (args too long) to make script portable
2 parents e32bdc1 + 3b04073 commit 99b8501

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

manifests/src/update_etags.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
input_file="$1"
66

7-
urls=$(jq .[].url "${input_file}" | tr -d '"')
7+
urls=$(jq '.[].url' "${input_file}" | tr -d '"')
88

99
# Pull and clean the etag from the AWS url
10-
NEW_ETAGS=$(printf "${urls}" | xargs -I {} sh -c "curl -I --silent {} | awk '/ETag:/ {print $2}' | cut -f2 -d' ' | tr -d '\"' | tr -d '\r'")
11-
10+
NEW_ETAGS=$(echo "$urls" | while IFS= read -r url; do
11+
curl -I --silent "$url" | awk '/ETag:/ {print $2}' | tr -d '"' | tr -d '\r'
12+
done)
1213
# Format the list into json
1314
JSON_LIST=$(printf '%s\n' "${NEW_ETAGS}" | jq -R . | jq -s .)
1415

0 commit comments

Comments
 (0)