From e7999a032bd888abf3665c501a754dbb922fe7c9 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Tue, 2 Feb 2021 03:39:56 +0300 Subject: Switch to org-mode for generating the website --- docs/docs/carbslinux/Shell-Conventions.html | 105 ++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 docs/docs/carbslinux/Shell-Conventions.html (limited to 'docs/docs/carbslinux/Shell-Conventions.html') diff --git a/docs/docs/carbslinux/Shell-Conventions.html b/docs/docs/carbslinux/Shell-Conventions.html new file mode 100644 index 0000000..5902238 --- /dev/null +++ b/docs/docs/carbslinux/Shell-Conventions.html @@ -0,0 +1,105 @@ + + + + + + +Shell Conventions (Carbs Linux User Manual) + + + + + + + + + + + + + + + + + + +
+

+Next: , Up: Conventions   [Contents]

+
+
+

3.1.1 Shell Conventions

+ +

Shell is central to Carbs Linux projects. Most of the tools and packages are +written in POSIX sh. +

+
+
[1010]
+

Use 4 spaces for indentation, don’t use tabs. +

+
[1020]
+

Make sure you don’t use bash-specific code. +

+
[1030]
+

Make sure you lint your code with ‘shellcheck’ and if +you are new to POSIX sh, use ‘checkbashisms’. +

+
[1040]
+

Don’t spawn new processes if you don’t absolutely need +to, especially during string manipulation. +

+
[1041]
+

Never use a program for text manupilation that isn’t +defined in the POSIX standard. This includes ‘gawk’ and ‘perl’. +

+
[1042]
+

Instead of $(basename $file), use ${file##*}. +

+
[1043]
+

Instead of $(dirname $file), use ${file%/*}. +

+
+ +
+
# This is the same thing as basename /path/to/test.asc .asc
+
+$ file=/path/to/test.asc file=${file##*/} file=${file%.asc}
+$ echo $file
+test
+
+
+
[1050]
+

Instead of backticks, use $(..). +

+
+ + + + + + -- cgit v1.2.3