shellcheck
shellcheck copied to clipboard
Allow colon separation for inline source-path directive
For bugs
- Rule Id (if any, e.g. SC1000): SC1091
- My shellcheck version (
shellcheck --version
or "online"): 0.8.0 - [x] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
- [x] I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit
For new checks and feature suggestions
- [x] https://www.shellcheck.net/ (i.e. the latest commit) currently gives no useful warnings about this
- [x] I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
# shellcheck source-path=path/to:/absolute/path/to
. ./script
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
No issue if either path/to/script
or /absolute/path/to/script
exists, but it seems that other than with the command-line option -P/--source-path
, the inline directive does not allow to specific multiple paths colon :
separated. What instead works is:
#!/bin/bash
# shellcheck source-path=path/to source-path=/absolute/path/to
. ./script
But it would be great if CLI and inline directive could be aligned. It took me a while to figure out that those behave differently 🙂.
I was using it on Ubuntu, I noticed using the colon fails but using a semi-colon succeeds. This is contrary to what the man pages says - Unix uses :
and windows uses ;
.
Ah, I haven't tested the semicolon. Indeed makes sense to align it with CLI to avoid confusion.