Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with shellcheck

23 views
Skip to first unread message

Kenny McCormack

unread,
Apr 1, 2023, 10:10:13 AM4/1/23
to
I have a script that starts with: #!/bin/dash

I want to "shellcheck" it. I do:

$ shellcheck myScript

and get err msg "

^-- SC1008: This shebang was unrecognized. Note that ShellCheck only
handles Bourne based shells.

OK, says I. There has to be a way to tell it which shell syntax to use.
So, I do: man shellcheck
and learn about the "-s" option.

I redo the comand as:

$ shellcheck -s sh myScript

but, surprisingly, get the same err msg. Is there a fix for this?

--
Life's big questions are big in the sense that they are momentous. However, contrary to
appearances, they are not big in the sense of being unanswerable. It is only that the answers
are generally unpalatable. There is no great mystery, but there is plenty of horror.
(https://en.wikiquote.org/wiki/David_Benatar)

Kenny McCormack

unread,
Apr 1, 2023, 10:18:09 AM4/1/23
to
In article <u09dvv$1r5ja$1...@news.xmission.com>,
Kenny McCormack <gaz...@shell.xmission.com> wrote:
...
>$ shellcheck -s sh myScript
>
>but, surprisingly, get the same err msg. Is there a fix for this?

Update: The following seems to be a workaround:

$ sed 1s/da// myScript | shellcheck /dev/stdin

Of course, it'd be better if the "-s" option worked as expected.

P.S. And, yes, there is a reason I prefer to use #!/bin/dash instead of #!/bin/sh.

--
It's possible that leasing office space to a Starbucks is a greater liability
in today's GOP than is hitting your mother on the head with a hammer.

Lew Pitcher

unread,
Apr 1, 2023, 10:25:49 AM4/1/23
to
On Sat, 01 Apr 2023 14:10:07 +0000, Kenny McCormack wrote:

> I have a script that starts with: #!/bin/dash
>
> I want to "shellcheck" it. I do:
>
> $ shellcheck myScript
>
> and get err msg "
>
> ^-- SC1008: This shebang was unrecognized. Note that ShellCheck only
> handles Bourne based shells.
>
> OK, says I. There has to be a way to tell it which shell syntax to use.
> So, I do: man shellcheck
> and learn about the "-s" option.
>
> I redo the comand as:
>
> $ shellcheck -s sh myScript
>
> but, surprisingly, get the same err msg. Is there a fix for this?

What version of shellcheck are you running? The current version seems
to be 0.9.0, released on Dec 13, 2022 [1].

According to the shellcheck wiki[2] (buried in the documentation on
the SC1008 error[3]) shellcheck /does/ support parsing of dash scripts.
OTOH, the error msg you quoted explicitly says that it does not. This
leads me to believe that shellcheck added dash support in a version
later than the one you run.

Perhaps an upgrade is in order?

[1] https://github.com/koalaman/shellcheck/releases/tag/v0.9.0
[2] https://github.com/koalaman/shellcheck/wiki
[3] https://github.com/koalaman/shellcheck/wiki/SC1008
--
Lew Pitcher
"In Skills We Trust"

Lew Pitcher

unread,
Apr 1, 2023, 10:31:22 AM4/1/23
to
On Sat, 01 Apr 2023 14:25:43 +0000, Lew Pitcher wrote:

> On Sat, 01 Apr 2023 14:10:07 +0000, Kenny McCormack wrote:
>
>> I have a script that starts with: #!/bin/dash
>>
>> I want to "shellcheck" it. I do:
>>
>> $ shellcheck myScript
>>
>> and get err msg "
>>
>> ^-- SC1008: This shebang was unrecognized. Note that ShellCheck only
>> handles Bourne based shells.
>>
>> OK, says I. There has to be a way to tell it which shell syntax to use.
>> So, I do: man shellcheck
>> and learn about the "-s" option.
>>
>> I redo the comand as:
>>
>> $ shellcheck -s sh myScript
>>
>> but, surprisingly, get the same err msg. Is there a fix for this?
>
> What version of shellcheck are you running? The current version seems
> to be 0.9.0, released on Dec 13, 2022 [1].

FWIW, It appears that dash support was added to shellcheck in v0.4.2
(Jan 9, 2016) and maintenance applied in various releases after.

[snip]

Kenny McCormack

unread,
Apr 1, 2023, 10:37:53 AM4/1/23
to
In article <u09f7k$1t8qm$2...@dont-email.me>,
Lew Pitcher <lew.p...@digitalfreehold.ca> wrote:
...
>> What version of shellcheck are you running? The current version seems
>> to be 0.9.0, released on Dec 13, 2022 [1].
>
>FWIW, It appears that dash support was added to shellcheck in v0.4.2
>(Jan 9, 2016) and maintenance applied in various releases after.

My version seems to be: 0.3.4-3

So, yeah, I'll see about getting a newer version.

Thanks for checking.

--
Elect a clown, expect a circus.

Jalen Q

unread,
Apr 11, 2023, 11:47:54 PM4/11/23
to
NHGVFFFFFFRFRRFRFRFRFVGGVGVGVGGVGVGGVGGVGVGVG

Jalen Q

unread,
Apr 11, 2023, 11:48:03 PM4/11/23
to
On Saturday, April 1, 2023 at 9:37:53 AM UTC-5, Kenny McCormack wrote:
VVYVVVVVYYVVYCCC
0 new messages