• Problem with shellcheck

    From Kenny McCormack@21:1/5 to All on Sat Apr 1 14:10:07 2023
    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)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Lew Pitcher on Sat Apr 1 14:31:17 2023
    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]
    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Kenny McCormack on Sat Apr 1 14:25:43 2023
    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"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to lew.pitcher@digitalfreehold.ca on Sat Apr 1 14:37:47 2023
    In article <u09f7k$1t8qm$2@dont-email.me>,
    Lew Pitcher <lew.pitcher@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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to Kenny McCormack on Sat Apr 1 14:18:04 2023
    In article <u09dvv$1r5ja$1@news.xmission.com>,
    Kenny McCormack <gazelle@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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jalen Q@21:1/5 to Kenny McCormack on Tue Apr 11 20:48:00 2023
    On Saturday, April 1, 2023 at 9:37:53 AM UTC-5, Kenny McCormack wrote:
    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.
    VVYVVVVVYYVVYCCC

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jalen Q@21:1/5 to Kenny McCormack on Tue Apr 11 20:47:51 2023
    On Saturday, April 1, 2023 at 9:37:53 AM UTC-5, Kenny McCormack wrote:
    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.
    NHGVFFFFFFRFRRFRFRFRFVGGVGVGVGGVGVGGVGGVGVGVG

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)