Bug#1132524: shellcheck: avoid-nullary-conditions ignores test command
Seth McDonald
dev at sethm.id.au
Thu Apr 2 09:37:34 BST 2026
Package: shellcheck
Version: 0.11.0-2
Severity: normal
Dear Maintainer,
shellcheck has the optional check 'avoid-nullary-conditions' which warns
of use of the [ command to check for nonempty strings without explicitly
specifying the -n option. However, it fails to warn of the same use
with the equivalent test command.
Consider the following sequence of commands.
$ echo '#!/bin/sh' > test.sh
$ echo 'test "$HOME"' >> test.sh
$ shellcheck --enable avoid-nullary-conditions test.sh
The file 'test.sh' is created with a test command on line 2 that I would
expect should trigger the avoid-nullary-conditions check. But the final
shellcheck command does not output the corresponding warning.
Take care,
Seth McDonald.
-- System Information:
Debian Release: 13.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable'), (50, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 6.12.74+deb13+1-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE=en_AU:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages shellcheck depends on:
ii libc6 2.41-12+deb13u2
ii libffi8 3.4.8-2
ii libgmp10 2:6.3.0+dfsg-3
ii libnuma1 2.0.19-1
shellcheck recommends no packages.
shellcheck suggests no packages.
-- no debconf information
More information about the Pkg-haskell-maintainers
mailing list