wirelessduck--- via Dng <dng@???> writes:
> On 18 Dec 2023, at 08:41, aitor <aitor_czr@???> wrote:
>
> I didn't know about shellcheck:
> https://www.shellcheck.net/
> I'll read the documentation on the wiki.
> Thanks!
> Aitor.
>
> I forgot to mention shellcheck is available in Devuan/debian
> repositories and probably for most other distros too.
>
> I normally run it with --enable=all to get all the optional checks and
> --shell=sh to stick to posix compatibility unless I’m specifically
> needing some bash feature.
Just start your shell scripts with '#!/bin/sh' and shellcheck will pick
up that you want '--shell=sh'.
That's become '#!/usr/bin/sh' after usr-merge ... urk.
Or maybe even '#!/usr/bin/env sh' but I don't know if shellcheck will
grok that.
> If you want to format your shell scripts for consistency or
> readability, I can suggest`shfmt`. Also available from Devuan/debian
> repositories as of the Daedalus/bookworm release.
:+1:
Both are nice additions to your git pre-commit hooks, btw!
Hope this helps,
--
Olaf Meeuwissen