mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created Ignore (markdown)
24
Ignore.md
Normal file
24
Ignore.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
## Ignoring errors
|
||||||
|
|
||||||
|
To ignore a shellcheck error, you can do one of three things:
|
||||||
|
|
||||||
|
### Ignoring one specific instance in a file
|
||||||
|
|
||||||
|
Use a [[directive]] to disable a certain instance:
|
||||||
|
|
||||||
|
hexToAscii() {
|
||||||
|
# shellcheck disable=SC2059
|
||||||
|
printf "\x$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
### Ignoring errors in one specific run
|
||||||
|
|
||||||
|
Use a `-e` flag to disable a specific error when running shellcheck:
|
||||||
|
|
||||||
|
$ shellcheck -e SC2059 myscript
|
||||||
|
|
||||||
|
### Ignoring one type of error forever
|
||||||
|
|
||||||
|
Set the `SHELLCHECK_OPTS` variable in your `.bashrc`, `/etc/profile` or equivalent:
|
||||||
|
|
||||||
|
export SHELLCHECK_OPTS="-e SC2059"
|
Reference in New Issue
Block a user