Category: The Shell Programming Language

  • “ShellCheck finds bugs in your shell scripts” – shell script analysis tool “You can cabal, apt, dnf, pkg or brew install it locally right now” “already packaged for your distro or package manager” “written in Haskell, if you’re into that sort of thing”

  • the “bash” utility has an switch to deal with shell patterns that do not resolve – what’s its name? $ shopt -s nullglob I am making use of that feature in this script:

  • Unix 7th Edition Manuals in PDF – where to get them these documents contain the manual pages (in original layout) describing the Bourne Shell, awk etc

  • Bash: [[…]]: the pattern, quoting, … — look for the very helpful xxx.txt example! I was tempted to put the entire pattern in (double) quotes. But that’s not Bash style. You can “certainly” put literal parts in quotes, but regexp parts do not belong in quotes — quotes are good for protecting, amongst other aspects: protecting against interpretation as regular expression. That’s […]

  • O’Reilly Media book: Learning the bash Shell, 3rd Edition

    Learning the bash Shell, 3rd Edition – O’Reilly Media

  • O’Reilly Media book: bash Cookbook

    bash Cookbook – O’Reilly Media

  • ksh88 man page – the man page NAME SYNOPSIS DESCRIPTION Definitions Commands Comments Aliasing Tilde Substitution Command Substitution Process Substitution Parameter Substitution Blank Interpretation File Name Generation; bash: shopt extglob on # “extended globbing” Quoting Arithmetic Evaluation Prompting Conditional Expressions Input/Output Environment Functions Jobs Signals Execution Command Re-entry In-line Editing Options Emacs Editing Mode Vi Editing Mode Input […]

  • O’Reilly Media book: Classic Shell Scripting (a Git repository) nice scripts shown there and available in the sample code: – rather similar to my own – rather similar to my own – but has a problem with “md5sum” – I fixed that …  

  • shell programming: “for” loops vs. “while” loops and scope of variables created within loop bodies

    Variables, that you create (by assignment) within loop bodies, are well visible outside the loop body. This is valid for both kinds of loop. CAVEAT: If the “while” loop reads from a pipe, the “while” loop is executed within a subshell, i.e. the scope of the variables within the loop ends with the loop. Example: […]

  • GNU Coreutils “seq”

    the manual page. Why do I keep forgetting the name of this wonderful little helper? seq prints a sequence of numbers to standard output. Synopses: seq [option]… last seq [option]… first last seq [option]… first increment last seq prints the numbers from first to last by increment. By default, each number is printed on a separate line. When increment is not specified, it defaults […]