Skip to content

Latest commit

 

History

History
176 lines (138 loc) · 6.84 KB

File metadata and controls

176 lines (138 loc) · 6.84 KB

Scripting Tutorial

© Joaquin Menchaca, 2014-2026

Overview

This repository contains a comprehensive suite of automation scripts, tools, and educational resources, spanning foundational language lessons to production-grade deployment workflows. It serves as a practical showcase of CI/CD orchestration, build automation, and infrastructure-as-code principles.

🛠️ Key Capabilities

  • Build & Test Frameworks: Advanced build pipelines orchestrated via Rake and Psake.
  • CI/CD Integration: Automated testing configurations designed for GitHub Actions and local testing via Act.
  • Meta-Installers: Dynamic generation tools that automatically compile custom deployment and installation scripts.
  • Compilation Automation: Optimized Makefiles for streamlined, reproducible source compilation.
  • Educational Resources: A curated collection of novice-to-intermediate programming language lessons.

Tutorials

This tutorial introduces core scripting automation modeled after foundational POSIX Shell system administration tasks.

Designed both as a beginner's guide and a quick-reference handbook, these lessons cover essential programming patterns across major historical and modern scripting environments. Readers will learn practical automation for both Linux/Unix and Windows operating ecosystems.

CI-Box (Continuous Integration)

The CIBox area are Continuous Integration scripts currently supporting GHA for automated testing, and local testing with Act.

Script-Box

The ScriptBox area contains tools and scripts that may be useful in this tutorial. Some highlights include:

  • generate_install_sh.rb - generates an installer script for your environment, such as Ubuntu 22.04.
  • validate_commands.rb - validate installation or availability of all languages used in this guide
  • compile_check.rb - will test the Makefiles in parallel (threads) for C++, C#, Java, Go, Rust.
  • run_all_tests.ps1 - will run all the tests using the test harness (TestBox.psm1) with psake
  • run_all_tests.rb - will run all the tests the test harness (Script.rb) with rake

Further Information:

Test-Box

The TestBox area contains the test harnesses used to test these languages.

  • Ruby-based Test Harness (Script.rb) and uses rake to execute the tests
  • Powershell-based Test Harness (Testbox.psm1) and uses Invoke-psake to execute the tests
  • Test Plan (expected.json) is list of inputs (stdin, args), outputs (stdout, stderr), and environments variables.
  • Test Titles (titles.json) are descriptive titles for the tests.

These scripts will test the environment (macOS, Linux, Windows, Cygwin, MSYS2, WSL) and then execute the tests appropriately.

Further Information:

Lesson Languages

The Languages

These are the languages supported.

  • General Languages:
    • 📜 AWK
    • ☕ Groovy¹
    • 🐫 Perl
    • 🐘 PHP
    • 🐍 Python
    • 💎 Ruby
    • 📜 TCL (Tool Command Language)
  • Shell Languages:
    • 🐚 Bourne Again Shell (bash)²
    • 🐚 C Shell (csh)²
    • 🐚 Korn Shell (ksh)²
    • 🐚 Shell, POSIX (sh)²
    • 🐚 Z Shell (zsh)²
  • Windows Languages:
    • 📜 Command Shell (BATCH)³
    • 📜 JScript (WSH)³
    • 📜 PowerShell (pwsh)
    • 📜 VBScript (WSH)³
  • Compiled Languages:
    • ➕ C++
    • 🎼 C#⁴
    • 🦫 Go
    • ☕ Java¹
    • 🦀 Rust
  1. Requires JDK environment to compile or run.
  2. Utilities available with either POSIX Utilities or GNU Core-Utils may be used.
  3. Requires a Windows environment or translations (WINE)
  4. Requires Dotnet SDK environment to compile or run.

The Lessons

This is the overall plan for 14 topics and about 47 lessons (varies per language support for functionality):

Part I

This covers the basics of input/output, logic flow, variables, and data structures (arrays, associative arrays).

  • 📚 Output
    • 📗 Standard Output [A00]
    • 📗 Standard Error [A10]
    • 📗 Here Document (Multiline Output) [A20]
  • 📚 Variables
    • 📗 String Concatenation [B00]
    • 📗 Variable Interpolation [B10]
    • 📗 Formatting [B20]
    • 📗 Here String (Multiline String) [B30]
  • 📚 Arithmetic
    • 📗 Basic Arithmetic [C00]
    • 📗 Boolean Logic [C10]
    • 📗 Exponential [C20]
    • 📗 Math Function [C30]
  • 📚 Input
    • 📗 Reading a Line [D00]
    • 📗 Reading a Single Character [D10]
  • 📚 Branching
    • 📗 Branch on String [E00]
    • 📗 Ternary [E10]
    • 📗 Branch on Number Range [E20]
    • 📗 Branch on Number [E30]
    • 📗 Multiway Branch on Number [E40]
    • 📗 Multiway Branch on String Pattern [E50]
    • 📗 Branch on String Pattern [E60]
  • 📚 Looping
    • 📗 Collection Loop [F00]
    • 📗 Count Loop [F10]
    • 📗 Conditional Loop [F20]
    • 📗 Spin Loop [F30]
    • 📗 Skipping [F40]
  • 📚 Arrays
    • 📗 Assign by Index and Length [G00]
    • 📗 Assign by List and Enumeration by Item [G10]
    • 📗 Assign by List and Enumeration by Index [G20]
  • 📚 Associative Arrays
    • 📗 Assign by Key [H00]
    • 📗 Assign by List and Appending [H10]

Part II

This covers sub-routines and functions, passing values (parameters), and retrieving data. This also covers parsing command line arguments.

  • 📚 Sub-Routines
    • 📗 Creation and Calling [I00]
    • 📗 Global Variable (Scope) [I10]
    • 📗 Local Variable (Scope) [I20]
  • 📚 Arguments from the Command Line
    • 📗 Usage Statement (Script Name and Arg Count) [J00]
    • 📗 Enumerate Arguments in Order [J10]
    • 📗 Enumerate Arguments in Reverse Order [J20]
  • 📚 Parameters
    • 📗 Pass a Single Parameters [K00]
    • 📗 Pass Variable Number of Parameters [K10]
  • 📚 Exit
    • 📗 Returning an Exit Status Code [L00]
  • 📚 Functions
    • 📗 Return an Integer [M00]
    • 📗 Return a String [M10]
    • 📗 Return an Array [M20]

Part III

This section is under development, and may be put into another advance scripting section. As such, material is being developed for it. Areas important for basic system administration chores will be configuring environment variables, and having more advance command line argument processing with options and flags.

  • 📚 Environment Variables
    • 📗 Enumerating Variables [N00]
    • 📗 Enumerating Paths [N10]
    • 📗 Augmenting Variables [N20]
    • 📗 Exporting Variables [N30]
  • 📚 Options [O00]
    • 📗 Flags [O00]
    • 📗 Options [O10]
    • 📗 Long Form [O20]