Advanced Bash-Scripting Guide

About

(TODO: A more sophisticated introductional paragraph here)

The Advanced Bash-Scripting Guide is a book written by Mendel Cooper and part of The Linux Documentation Project, page Guides. This is a fork of the original work which itself had been (since 2014) dedicated to the Public Domain.

Web

To read in a browser, follow the link Advanced Bash-Scripting Guide

For off-line viewing download and unpack: bash-scripting-guide.zip (TODO)

Web fonts

The HTML styling sets font-family: serif/sans-serif/monospace without any specific font names, font-size: is set in units of em, the main size is 1 em.

This approach respects the font name and font size settings of the browser, it adapts across monitor sizes and pixel resolutions.

GNU Info format

Viewer

What is GNU Info?

GNU Info is a help viewer that operates in a hypertext format for easy navigation of multi-page documentation. It is useful in the conditions of a terminal session.

Example page from the book displayed in Info:

Next: Special Characters,  Prev: Invoking the script,  Up: Top

6 Special chars, variables
**************************

Together with the "keywords", the "special characters" and the
"variables" are the building block of scripts.

   _Special characters_ have meta-meaning.  _Variables_ are how
programming and scripting languages represent data.

* Menu:

* Special Characters::  Special Characters
* Variable Substitution::       Retrieving values of variables
* Variable Assignment:: The assignment operator
* Untyped variables::   Bash Variables Are Untyped
* Variable Types::      Special Variable Types




-----Info: (bash-scripting-guide)Basics, 19 lines --All-------------------------

Enable colors in Info

The default configuration of Info in the terminal might be too austere, for easier visual navigation it can be configured to display the hypertext links with colors

$ info -v link-style=blue -v active-link-style=yellow -f bash-scripting-guide.info
To set permanently create a config like this:
$ cat ~/.infokey
#var
link-style=blue,bold
active-link-style=yellow,standout
match-style=bold

Download and Install

Your OS already comes with documentation in Info format, it resides in /usr/share/info.

Common convention for all external manuals would be to be kept in a separate directory, for example ~/.local/share/info. There a special file, named dir, lists the documentation installed in it. To add to it invoke install-info.

Download via URL: bash-scripting-guide.info (1.6M) in a browser of via wget

$ mkdir -p ~/.local/share/info
$ cd ~/.local/share/info
$ wget https://hangar118.sdf.org/p/bash-scripting-guide-home/bash-scripting-guide.info
$ install-info --add-once bash-scripting-guide.info dir
To inform Info about the custom folder, invoke via option --dir
$ info --dir ~/.local/share/info
Or set INFOPATH
$ export INFOPATH=~/.local/share/info
To go directly to the manual bypassing the Dir page of Info do:
$ info -f bash-scripting-guide

Emacs

Emacs has a built-in viewer of Info documentation, the Info directory is shared between Emacs and the standalone GNU Info reader.

To make this custom directory available to Emacs add this snippet to your init.el:
(add-to-list 'Info-default-directory-list "~/.local/share/info")

Resources on GNU Info

Contribute

The book is a cooperatively developed project on GitHub, contributions are welcome: https://github.com/pmarinov/bash-scripting-guide
Contents of this page is public domain (CC0)