Artículos relacionados a Bash 5.3 Programming in 14 Days: Master Defensive Shell...

Bash 5.3 Programming in 14 Days: Master Defensive Shell Scripting for Sysadmin Automation through Daily Drills (Learn Programming in 14 Days) - Tapa blanda

Libro 7 de 10: Learn Programming in 14 Days

Saqib, Mohammad

 
9798193642473: Bash 5.3 Programming in 14 Days: Master Defensive Shell Scripting for Sysadmin Automation through Daily Drills (Learn Programming in 14 Days)

Sinopsis

Fourteen days of drills that turn shell scripting into something you can trust on a machine you cannot watch.


This is a book of problems. Every rule is stated in as few words as it can be, shown working in a short script with its real captured output, and then handed back as drills. Nothing is asserted that is not also demonstrated: every listing in the book was run under GNU Bash 5.3.15 on Linux, and every printed result was captured from that run.


The programming problems build one real tool across the fourteen days. It is called sentry, a host audit command. It begins on Day 1 as a script that refuses to run half-broken and gains, day by day, arguments that survive a space, settings with defaults, named checks chosen by option, tallies in arrays, log reading that loses no character, file discovery that survives every legal filename, a formatted report, checks that run in parallel behind a lock, and finally a dry run, a self-test, a log and an installable command.


The shell is not a passenger here. Quoting decides whether a filename with a space is one argument or two. Strict mode decides whether a failed command stops the script or is ignored. A subshell decides whether a counter survives the loop that filled it. Every one of those decisions is shown as a measurement rather than an opinion, and the book prints both outcomes.


The two weeks run in two movements. Days 1 to 7 cover the language: the execution model and strict mode, quoting and expansions, parameter expansion, tests and control flow, arrays, functions and scope, and reading input safely. Days 8 to 14 cover the machine: processes, pipelines and exit status, globs and awkward filenames, traps and cleanup, text processing inside the shell, concurrency and locking, the failure modes a defensive script must survive, and packaging a script an operator can run at three in the morning.


Every chapter has the same shape. Numbered sections state the rules. Twenty worked examples show each rule running, each with a complete script, its real output, a figure and a short explanation. Then a fixed ladder of five problem sets: review questions, worked problems with full solutions, worked programming problems, and unassisted practice problems in both written and programming form. The review answers are at the end of the chapter; the practice problems have no answers anywhere, by design.


Your 14-day path


Week 1 - the language


  • Day 1 - The Shell, the Script and Strict Mode

  • Day 2 - Words, Quoting and the Order of Expansions

  • Day 3 - Parameters and Parameter Expansion

  • Day 4 - Tests, Conditions and Control Flow

  • Day 5 - Arrays and Associative Arrays

  • Day 6 - Functions, Scope and Return Values

  • Day 7 - Reading Input with read, IFS and File Descriptors

Week 2 - the machine


  • Day 8 - Processes, Pipelines and Exit Status

  • Day 9 - Files, Globs and Awkward Names

  • Day 10 - Traps, Signals and Cleanup

  • Day 11 - Text Processing inside the Shell

  • Day 12 - Concurrency, Jobs, wait and Locks

  • Day 13 - The Failure Modes of a Shell Script

  • Day 14 - Packaging a Script for Operations


Who it's for


System administrators who write the scripts a fleet depends on. Site reliability engineers who inherit them. Developers who maintain the shell that holds a deployment together. Readers preparing for a technical interview. Use of a command line is assumed. No prior scripting is assumed, and no other programming language.


280 worked examples. 462 figures. 910 problems. 358 pages. Written to GNU Bash 5.3.


Fourteen days. Work them in order, and do the problems.


"Sinopsis" puede pertenecer a otra edición de este libro.