Re: [dev] Shell style guide

From: Evan Gates <evan.gates_AT_gmail.com>
Date: Wed, 7 Sep 2016 14:29:01 -0700

On Wed, Sep 7, 2016 at 2:11 PM, Adrian Grigore
<adrian.emil.grigore_AT_gmail.com> wrote:
> Rendering was just an example, I doubt a shell script would be rendering.
>
> Example of camelCase I find ok is here:
> https://raw.githubusercontent.com/adriangrigore/bootstrap/master/bootstrap
>
> Be free to critique the script, but note that I'm new to the whole
> UNIX/C scene so learning as I go (if I did some blatant mistakes,
> please point them).
>

In this line:

>&2 echo usage: bootstrap name [description] [license]

You must quote. [description] is a glob, if you have a file named e in
the directory it will print: usage: bootstrap name e e

This line:

if [ $(license -list | tail -n +3 | awk '{ print $1 }' | grep "$type") ]; then

No need for [] nor $(), just use if license -list | ... | grep -q
"$type"; then
Also you should rarely, if ever, need both awk and grep in a single
pipeline (you can get rid of tail too and just license | awk)
Received on Wed Sep 07 2016 - 23:29:01 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 07 2016 - 23:36:13 CEST