Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jan 2019 13:36:15 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Devin Teske <dteske@freebsd.org>
Cc:        "Rodney W. Grimes" <rgrimes@freebsd.org>, Lars Engels <lme@freebsd.org>,  src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r342945 - in head: tools/build/mk usr.sbin/bluetooth usr.sbin/bluetooth/bluetooth-config
Message-ID:  <CANCZdfpD75%2BkSdydgtLPBeYh4Kut-pMbPSBv44pRdrY-ZAZzoQ@mail.gmail.com>
In-Reply-To: <12293ACC-4C9C-4BFB-A04B-85D43AFA0837@FreeBSD.org>
References:  <201901111916.x0BJGcLG022599@pdx.rh.CN85.dnsmgr.net> <12293ACC-4C9C-4BFB-A04B-85D43AFA0837@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 11, 2019, 1:12 PM Devin Teske <dteske@freebsd.org wrote:

>
>
> > On Jan 11, 2019, at 11:16 AM, Rodney W. Grimes <
> freebsd@pdx.rh.CN85.dnsmgr.net> wrote:
> >
> >>> On Jan 11, 2019, at 10:36 AM, Rodney W. Grimes <
> freebsd@pdx.rh.CN85.dnsmgr.net> wrote:
> >>>
> >>>> On Fri, Jan 11, 2019 at 10:10 AM Rodney W. Grimes <
> >>>> freebsd@pdx.rh.cn85.dnsmgr.net> wrote:
> >>>>
> >>>>>> On Fri, Jan 11, 2019 at 08:04:33AM -0800, Rodney W. Grimes wrote:
> >>>>>>> The style of this .sh does not match the normal style of
> >>>>>>> such things in base, especially with respect to long lines
> >>>>>>> and indentation.
> >>>>>>
> >>>>>> Do we have a style guide for shell scripts in base? How should
> >>>>>> indentation look like?
> >>>>>
> >>>>> Not that I can locate, but I can state that almost all
> >>>>> of the base code uses tab indenting and limited to 80
> >>>>> column widths, independent of c, sh, make, etc.
> >>>>>
> >>>>
> >>>> We have a style.Makefile, style, style.mdoc and style.lua man pages.
> Maybe
> >>>> it's time for style.sh, eh?
> >>>
> >>> Yes please!
> >>>
> >>
> >> If we can agree to be professional and collegial, ...
> >>
> >> I'll start with chapters from the Style section of my book:
> >>
> https://freebsdfrau.gitbooks.io/serious-shell-programming/content/style/awk.html
> >> <
> https://freebsdfrau.gitbooks.io/serious-shell-programming/content/style/awk.html
> >
> >
> > If you can mdoc that and
>
> Surely.
>
>
> > take what applies to /bin/sh.
> >
>
> It *exclusively* applies to /bin/sh (as does my entire book).
>
>
> > Might be easier to start with one of the other style.foo pages though.
>
> I already did. Started with style(9), going back to mdoc would be easy.
>
>
> > And we don't want to go to far and put all of our sh code
> > out of conformance.
>
> The Style entry in my book is based on my FreeBSD sh code.
>
>
>
> >   For one variable being $foo or ${foo}
> > is varied greatly, IMHO the rule should be that the file just
> > be consistent through out, and that one or the other is the
> > prefered style, but either is acceptable.
> >
>
> I talked about this at BSDCan in June. $foo is preferred (there
> *is* a difference) and, as you say, if a file is consistently ${foo}
> then it is fine.
>

I prefer {} because $foo:bar doesn't work while ${foo}:bar does.

Warner

>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpD75%2BkSdydgtLPBeYh4Kut-pMbPSBv44pRdrY-ZAZzoQ>