Fix shellcheck linter reported issues
What does this MR do?
Fixes the warnings reported by shellcheck
in !2220 (closed)
Why was this MR needed?
To make !2220 (closed) a smaller MR focusing only on introducing the linter.
What's the best way to test this MR?
What are the relevant issue numbers?
Closes #9524