Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFS= should be suggested for while read -r line; do to avoid omitting leading spaces #2619

Open
2 tasks done
Cyberbeni opened this issue Nov 3, 2022 · 0 comments
Open
2 tasks done

Comments

@Cyberbeni
Copy link

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

#!/usr/bin/env bash

changes=()
while read -r line; do
	code="${line:0:2}"
	case "$code" in
		"??"|A?|?A|M?|?M)
			changes+=("${line:3}")
			;;
	esac
done < <(git status --porcelain=v1 --no-renames --ignore-submodules=all)

Here's what shellcheck currently says:

Nothing

Here's what I wanted or expected to see:

Warning about omitted leading spaces and suggesting correcting to while IFS= read -r line; do

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

No branches or pull requests

1 participant