Skip to content

Guideline for all

adrianbartyczak edited this page Apr 7, 2018 · 11 revisions

Guideline for all solutions in Gnu-linux-shell-use.

General

As one core characteristic of Gnu-linux-shell-use is reusability, each solution adheres to the following rules:

  • Use a standard approach.
  • Provide documentation.
  • Do not contain deprecated or old-styled code.
  • Use portable syntax whene possible (some current solutions still have to be updated).
  • Include a source if one exists.
  • Do not depend on another solution.

In adherence to the principle of simplicity, all solutions also adhere to the following rules:

  • Do not alter any system files.
  • Output data only to
    ${HOME}/.computingfoundation/gnu-linux-shell-use[--packaged-solutions]/<solution_name[-additional_part]>/.

Code style

General

Lines and indentation
  • Spaces are used for all whitespace (tabs are allowed for Bash Here documents only).
  • An indent is 2 spaces.
Strings
  • Single quotes are used when possible.

Bash

Variables
  • An argument variable (e.g. ${1}) is used directly rather than being assigned to a new variable when possible.
  • A variable in an arithmetic expression is called without brackets (e.g. $((numEntries - count)), not $((${numEntries} - ${count}))).
Other
  • POSIX is used over extended Bash syntax (e.g. single bracket instead of double bracket conditionals) when possible.
  • A case block is used when matching 3 or more values.
  • A parameter expansion is quoted unless required otherwise.
  • A command substitution is quoted unless required otherwise.

Perl

Variables
  • A variable does not use brackets (e.g. $var, not ${var}) except when it makes sense to (e.g. in regular expressions and large scopes).
Strings
  • A variable inside a string value is simply appended to the string and the entire string is quoted with double quotes rather than using explicit concatenation.
Other
  • Parentheses are used when calling user-defined functions.
Clone this wiki locally
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy