Shellcheck: Trailing comma causes unexpected output

Created on 1 Jun 2018  路  3Comments  路  Source: koalaman/shellcheck

For bugs

  • Rule Id (if any, e.g. SC1000): N/A
  • My shellcheck version (shellcheck --version or "online"): 0.4.7
  • [x] I tried on shellcheck.net and verified that this is still a problem on the latest commit
  • [x] It's not reproducible on shellcheck.net, but I think that's because it's an OS, configuration or encoding issue

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

koalaman-shellcheck-issues-1241

$ docker run --rm -v "$(pwd):/mnt" koalaman/shellcheck:latest ./sample.bash  --exclude=SC1090,

```bash:sample.bash

!/usr/bin/env bash

function sample () {
$1 $2
}

#### Here's what shellcheck currently says:

shellcheck: Prelude.read: no parse

#### Here's what I wanted or expected to see:

If I remove the trailing comma from `--exclude=SC1090,`, it shows the expected output:

In ./script/sample.bash line 4:
$1 $2
^-- SC2086: Double quote to prevent globbing and word splitting.
```

All 3 comments

The same behavior also happens if the flag is blank (i.e. --exclude=).

I installed from source on master and the behavior for both of these is fixed. It is not a part of the 5.0.0 release, however.

Thanks, @Tahler. I'll close this issue based on your verification.

Was this page helpful?
0 / 5 - 0 ratings