Repository navigation
Cannot disable ignored for multiple statements on one line < can't ignore SC2024 with inline directive # shellcheck disable=SC2024 #3448
New issue
New issue
Open
#3633
Open
Cannot disable ignored for multiple statements on one line < can't ignore SC2024 with inline directive # shellcheck disable=SC2024 #3448
#3633
Description
@iconoclasthero's profile
iconoclasthero
opened
on Apr 14, 2026
For bugs with existing features
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
errorlog=/tmp/error.log
# shellcheck disable=SC2024
sudo apt update; sudo apt install -y google-chrome-stable >> "$errorlog"
echo "$errorlog"
exit
Here's what shellcheck currently says:
$ shellcheck myscript
[Line 4:](javascript:setPosition(4, 59))
sudo apt update; sudo apt install -y google-chrome-stable >> "$errorlog"
^-- [SC2024](https://www.shellcheck.net/wiki/SC2024) (warning): sudo doesn't affect redirects. Use .. | sudo tee -a file
$
Here's what I wanted or expected to see:
$ shellcheck myscript
No issues detected!
$
Additional:
- Tried removing the indentation, still shows the warning.
- Tried stripping the code down to bare minimum (functional line between shbang and shellcheck directive: i.e., declare var, echo var after, exit.)
- Tried adding it to the script-wide directive (i.e., under the shbang) and it removed the warning.
- The wiki page specifically says this can be ignored:
Exceptions
If you want to run a command as root but redirect as the normal user, you can ignore this message.
Metadata
Metadata
Assignees
No one assigned
Labels
No labels
No labels
Type
No type
Projects
No projects
Milestone
No milestone
Relationships
None yet
Development
No branches or pull requests
Issue actions