Not following: blip.bash: openFile: does not exist (No such file or directory) Open
if ! BLIP_REQUIRE_VERSION=0.9.1 PATH="$PATH:/usr/lib:$HOME/bin" source blip.bash
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Not following: (error message here)
Reasons include: file not found, no permissions, not included on the command line, not allowing shellcheck
to follow files with -x
, etc.
Problematic code:
source somefile
Correct code:
# shellcheck disable=SC1091
source somefile
Rationale:
ShellCheck, for whichever reason, is not able to access the source file.
This could be because you did not include it on the command line, did not use shellcheck -x
to allow following other files, don't have permissions or a variety of other problems.
Feel free to ignore the error with a [[directive]].
Exceptions:
If you're fine with it, ignore the message with a [[directive]].
Notice
Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.
This redirection doesn't have a command. Move to its command (or use 'true' as no-op). Open
exec > >( 2>&-; logger -s -t "${0##*/}[$$]" -p user.info 2>&1 \
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
Problematic code:
{
echo "Report for $(date +%F)"
uptime
df -h
}
> report.txt
Correct code:
{
echo "Report for $(date +%F)"
uptime
df -h
} > report.txt
Rationale:
ShellCheck found a redirection that doesn't actually redirect from/to anything.
This could indicate a bug, such as in the problematic code where an additional linefeed causes report.txt
to be truncated instead of containing report output, or in foo & > bar
, where either foo &> bar
or foo > bar &
was intended.
However, it could also be intentionally used to truncate a file or check that it's readable. You can make this more explicit for both ShellCheck and human readers by using true
or :
as a dummy command, e.g. true > file
or : > file
.
Exceptions:
There are no semantic problems with using > foo
over true > foo
, so if you don't see this as a potential source of bugs or confusion, you can [[ignore]] it.
Notice
Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.