-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC2329
Vidar Holen edited this page May 4, 2024
·
1 revision
#!/bin/sh
f() {
echo "Hello World"
}
exit
#!/bin/sh
f() {
echo "Hello World"
}
f
exit
ShellCheck found a function that goes out of scope before it's ever invoked. Verify that the function is called. It could be misspelled, or its invocation could also be unreachable (as in f() { ..; }; exit; f
).
Note that if the example script did not end in exit
, this warning would not be emitted. This is because the function could be invoked by another script that source
s it.
ShellCheck is currently bad at figuring out functions that are invoked via trap
. In such cases, please ignore the message with a directive.
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!