bash style guide on Fedora?
Hi, We can see several bash (= sh on Fedora) script files under /etc such as /etc/init.d/functions /etc/profile Anyone could you tell me whether there is a common style guideline (coding standards) to write the shell script on Feodra? Thanks, Jun Aruga -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: bash style guide on Fedora?
On Mon, Aug 22, 2016 at 10:01 AM Jun Aruga wrote: > Hi, > > We can see several bash (= sh on Fedora) script files under /etc such as > /etc/init.d/functions > /etc/profile > > Anyone could you tell me whether there is a common style guideline (coding > standards) to write the shell script on Feodra? > > Thanks, > Jun Aruga > > I'm not familiar with one, but I'd recommend using shellcheck on them to detect potential issues. -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: bash style guide on Fedora?
Hello, On Mon, Aug 22, 2016 at 7:55 PM, Christopher wrote: > On Mon, Aug 22, 2016 at 10:01 AM Jun Aruga wrote: > >> Hi, >> >> We can see several bash (= sh on Fedora) script files under /etc such as >> /etc/init.d/functions >> /etc/profile >> >> Anyone could you tell me whether there is a common style guideline >> (coding standards) to write the shell script on Feodra? >> >> Thanks, >> Jun Aruga >> >> > I'm not familiar with one, but I'd recommend using shellcheck on them to > detect potential issues. > > You can also take a look at bashate [ https://pypi.python.org/pypi/bashate ], an automated style checker for bash scripts to fill the same part of code review that pep8 does in most OpenStack projects. Thanks, Chandan Kumar -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: bash style guide on Fedora?
Hi, > I'm not familiar with one, but I'd recommend using shellcheck on them to > detect potential issues. Thanks. shellcheck? you mean "sh -n something.sh"? Yes, I will do it too :) I mean such as following pages, that I just searched on internet. https://google.github.io/styleguide/shell.xml https://github.com/icy/bash-coding-style http://wiki.bash-hackers.org/scripting/style Jun Aruga - Original Message - > From: "Christopher" > To: "Development discussions related to Fedora" > > Sent: Monday, August 22, 2016 4:25:16 PM > Subject: Re: bash style guide on Fedora? > > On Mon, Aug 22, 2016 at 10:01 AM Jun Aruga < jar...@redhat.com > wrote: > > > Hi, > > We can see several bash (= sh on Fedora) script files under /etc such as > /etc/init.d/functions > /etc/profile > > Anyone could you tell me whether there is a common style guideline (coding > standards) to write the shell script on Feodra? > > Thanks, > Jun Aruga > > > I'm not familiar with one, but I'd recommend using shellcheck on them to > detect potential issues. > > -- > devel mailing list > devel@lists.fedoraproject.org > https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org > -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: bash style guide on Fedora?
Hi, > You can also take a look at bashate [ https://pypi.python.org/pypi/bashate ], > an automated style checker for bash scripts > to fill the same part of code review that pep8 does in most OpenStack > projects. > Thanks, Its tool looks helpful & useful for me. I would take a look at it. Thanks. Jun Aruga - Original Message - > From: "chandan kumar" > To: "Development discussions related to Fedora" > > Sent: Monday, August 22, 2016 4:31:38 PM > Subject: Re: bash style guide on Fedora? > > Hello, > > On Mon, Aug 22, 2016 at 7:55 PM, Christopher < ctubb...@fedoraproject.org > > wrote: > > > > On Mon, Aug 22, 2016 at 10:01 AM Jun Aruga < jar...@redhat.com > wrote: > > > Hi, > > We can see several bash (= sh on Fedora) script files under /etc such as > /etc/init.d/functions > /etc/profile > > Anyone could you tell me whether there is a common style guideline (coding > standards) to write the shell script on Feodra? > > Thanks, > Jun Aruga > > > I'm not familiar with one, but I'd recommend using shellcheck on them to > detect potential issues. > > > You can also take a look at bashate [ https://pypi.python.org/pypi/bashate ], > an automated style checker for bash scripts > to fill the same part of code review that pep8 does in most OpenStack > projects. > Thanks, > > Chandan Kumar > > -- > devel mailing list > devel@lists.fedoraproject.org > https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org > -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: bash style guide on Fedora?
Jun Aruga wrote on Mon, Aug 22, 2016 at 10:36:48AM -0400: > shellcheck? you mean "sh -n something.sh"? Yes, I will do it too :) He does mean shellcheck[1]. It's nice; doesn't do style check (e.g. trailing spaces or whatsnot) but catches quite a lot of errors. [1] https://www.shellcheck.net/ -- Dominique Martinet -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: bash style guide on Fedora?
On 08/22/2016 09:31 AM, chandan kumar wrote: > You can also take a look at bashate [ https://pypi.python.org/pypi/bashate ], > an automated style checker for bash scripts > to fill the same part of code review that pep8 does in most OpenStack > projects. I'll second the usage of 'bashate'. It's really useful for keeping bash scripts a little more consistent. -- Major Hayden -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: bash style guide on Fedora?
On Mon, Aug 22, 2016 at 11:17 AM Dominique Martinet < dominique.marti...@cea.fr> wrote: > Jun Aruga wrote on Mon, Aug 22, 2016 at 10:36:48AM -0400: > > shellcheck? you mean "sh -n something.sh"? Yes, I will do it too :) > > He does mean shellcheck[1]. > > It's nice; doesn't do style check (e.g. trailing spaces or whatsnot) > but catches quite a lot of errors. > > > [1] https://www.shellcheck.net/ > Yes, this is the shellcheck[1] I meant, but it's also just packaged for Fedora: $ sudo dnf install ShellCheck $ shellcheck myscript.sh -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: bash style guide on Fedora?
Hi, Okay, I could install the shellcheck with the Fedora package. And it works, and it looks nice. I am going to use those 2 checkers for a while. Thanks. Jun Aruga - Original Message - > From: "Christopher" > To: "Development discussions related to Fedora" > > Sent: Monday, August 22, 2016 9:40:25 PM > Subject: Re: bash style guide on Fedora? > > On Mon, Aug 22, 2016 at 11:17 AM Dominique Martinet < > dominique.marti...@cea.fr > wrote: > > > Jun Aruga wrote on Mon, Aug 22, 2016 at 10:36:48AM -0400: > > shellcheck? you mean "sh -n something.sh"? Yes, I will do it too :) > > He does mean shellcheck[1]. > > It's nice; doesn't do style check (e.g. trailing spaces or whatsnot) > but catches quite a lot of errors. > > > [1] https://www.shellcheck.net/ > > Yes, this is the shellcheck[1] I meant, but it's also just packaged for > Fedora: > $ sudo dnf install ShellCheck > $ shellcheck myscript.sh > > > -- > devel mailing list > devel@lists.fedoraproject.org > https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org > -- devel mailing list devel@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org