Bug#922423: initscripts: formatting of scripts
Thorsten Glaser
tg at evolvis.org
Wed Mar 19 15:43:06 GMT 2025
@Mark with k, I’ve said all I needed on that topic.
Switching BTS Cc to -quiet in this subthread due to beginning OT-ness.
On Wed, 19 Mar 2025, Marc Chantreux wrote:
>> > Scripts should follow the style produced by shfmt(1)
>> FWIW, never heard of that tool.
>
>shell is one of my main programming langages since the last millenium
>and I confirm: shfmt is unkown by the communities I belong to.
Indeed.
>Also I would like to go one step further: as in some shells, the case
>separator can be ;; or ;&
… or ;|
(both ;& and ;| fall through, but one unconditionally, the other
re-evaluates)
>, "hiding" it in the cod indentation is something I wanted to avoid.
Put them on their own line at block end then, which is clear.
They are relevant only if that branch was already taken.
Prefixing, like you did in your example, only makes the patterns
less legible, which are the more important thing.
>case "${1}"
You don’t need the braces nor the quotes: the argument of case
is always evaluated in scalar context and thus never IFS-split
or anything.
Getting OT but you might be interested in:
https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=shellsnippets/shellsnippets.git;a=tree
bye,
//mirabilos
--
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh
More information about the Debian-init-diversity
mailing list