CyberCode Academy

Course 4 - Learning Linux Shell Scripting | Episode 1: Essential: Utilities, Variables, I/O, and Program Flow


Listen Later

In this lesson, you’ll learn about:
  • Shell I/O & printing: echo (flags like -n), printf for formatted output, colored text via escape sequences, and printing alignment/rounding.
  • File descriptors & redirection: stdin/stdout/stderr (0/1/2), >, >>, 2>, &>, piping |, tee, /dev/null, and creating custom FDs with exec.
  • Reading input & command output: read (including fixed-char reads), capturing command output via $(...) or backticks, and assigning pipeline results to variables.
  • Variables & environment: scalar assignment, environment variables (env), key system vars (PATH, UID, PS1), checking string length, and prepending paths.
  • Arrays: indexed arrays and associative arrays (Bash ≥4), listing elements/indexes, and getting array length.
  • Arithmetic: integer math with let, (( ... )), [...]; floating-point and advanced math with bc, and base conversions.
  • Functions & arguments: define/invoke functions, access $1, $@, and read exit status/return codes.
  • Control flow: if / else / nested conditionals, numeric and string comparisons ([[ ... ]]), logical operators && / ||, and the test command.
  • Loops & iterators: for (including C-style and sequence generation), while, and until (including infinite loops).
  • IFS & field handling: using IFS to parse CSV or colon-delimited data (e.g., /etc/passwd) safely.
  • Conditional execution & retries: loop until success patterns, use : for no-op, and sleep for delays between retries.
  • Aliases & safety: create/remove aliases (alias / unalias), persist to ~/.bashrc, and escape to avoid malicious alias interference.
  • Terminal control: tput for cursor, colors, and styling; stty for terminal modes (e.g., disable echo for password input).
  • Date/time utilities: format/parse dates, convert to/from Epoch, and compute time differences.
  • Debugging techniques: run scripts with -x, use set -x / set +x for scoped tracing, and add custom debug output (e.g., _debug checks).
  • Best practices: validate inputs, limit side effects, handle errors via exit codes, use strict quoting, and test scripts in safe environments.


You can listen and download our episodes for free on more than 10 different platforms:
https://linktr.ee/cybercode_academy
...more
View all episodesView all episodes
Download on the App Store

CyberCode AcademyBy CyberCode Academy