Skip to content

General cleanup of shell bits#127

Closed
charles-dyfis-net wants to merge 1 commit intoconcourse:masterfrom
charles-dyfis-net:shell-cleanup
Closed

General cleanup of shell bits#127
charles-dyfis-net wants to merge 1 commit intoconcourse:masterfrom
charles-dyfis-net:shell-cleanup

Conversation

@charles-dyfis-net
Copy link
Contributor

@charles-dyfis-net charles-dyfis-net commented Mar 30, 2025

  • Avoid sed use for functionality built into shell parameter expansion
  • Avoid piping into a while read loop, which introduces the surprising behaviors discussed in BashFAQ #24
  • Switch from nonstandard external command which to built-in, POSIX-standardized command -v
  • Avoid using pushd and popd (which are interactive-extension options, not guaranteed to be compiled into a noninteractive shell at all).

With this applied, shellcheck scripts/* runs clean.

Not yet addressed:

  • Failure to sanitize or escape strings substituted into JSON (base image does not provide jq or this would be trivial)
  • Use of set -e

- Avoid `sed` use for functionality built into shell parameter expansion
- Avoid piping into a `while read` loop, which introduces the surprising behaviors discussed in [BashFAQ 24](https://mywiki.wooledge.org/BashFAQ/024)
- Switch from external command `which` to built-in, POSIX-standardized `command -v`
- Avoid using pushd and popd (which are interactive-extension options, not guaranteed to be compiled into a noninteractive shell at all).

With this applied, `shellcheck scripts/*` runs clean.

Not yet addressed:

- Failure to sanitize or escape strings substituted into JSON (base image does not provide jq or this would be trivial)
- Use of [`set -e`](https://mywiki.wooledge.org/BashFAQ/105)
@taylorsilva
Copy link
Member

taylorsilva commented Jun 5, 2025

I fixed up the scripts in #134 and in some other commits/PRs as well. Not sure if you want to keep this open still or close it now.

@taylorsilva
Copy link
Member

Closing because stale and no response from OP.

@taylorsilva taylorsilva closed this Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants