Skip to content

Commit aaa1d78

Browse files
authored
Update 'loop over paths in file' example (#872)
Replaced the cat-based approach with a direct input redirection method using `while IFS= read -r`. This change ensures proper handling of the last line which doesn't have a trailing new line. ## Pull Request approval You will need to get your PR approved by at least one member of the Sourcegraph team. For reviews of docs formatting, styles, and component usage, please tag the docs team via the #docs Slack channel.
1 parent 94e73e5 commit aaa1d78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/batch-changes/batch-spec-cheat-sheet.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ on:
3131

3232
steps:
3333
- run: |
34-
cat /tmp/search-results | while read file;
34+
while IFS= read -r file || [ -n "$file" ]
3535
do
3636
sed -i 's/OLD-VALUE/NEW-VALUE/g;' "${file}"
37-
done
37+
done < /tmp/search-results
3838
container: alpine:3
3939
files:
4040
/tmp/search-results: ${{ join repository.search_result_paths "\n" }}

0 commit comments

Comments
 (0)