mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2310 (markdown)
@@ -42,7 +42,7 @@ echo "Backup successful"
|
||||
|
||||
ShellCheck found a function used as a condition in a script where `set -e` is enabled. This means that the function will run without `set -e`, and will power through any errors.
|
||||
|
||||
This applies to `if`, `while`, and `until` statements, commands negated with `!`, as well as the left-hand side of `||` and `&&`. It does matter how deeply the command is nested in such a structure.
|
||||
This applies to `if`, `while`, and `until` statements, commands negated with `!`, as well as the left-hand side of `||` and `&&`. It does not matter how deeply the command is nested in such a structure.
|
||||
|
||||
In the problematic example, the intent was that an error like `cp: error writing '/backup/important.txt': No space left on device` would cause the script to abort. Instead, since the function is invoked in an `if` statement, the script will proceed to delete all the files even though it failed to back them up.
|
||||
|
||||
|
Reference in New Issue
Block a user