Week 1 · Day 3 · 7 hours

Foundation – Shell Automation

Linux, GVim, Shell, Digital Design, Basic C++

Daily plan

What you will learn and practise

Complete the stages in order and retain the requested evidence.

Theory · 2h

Bash variables/arguments
if/case/for/while
Functions and exit status
Environment setup; simulation scripts
Basic Makefile concept

Guided lab · 2h

1. hello.sh
2. Command-line argument handling
3. File existence check
4. Loop through .v files
5. PASS/FAIL log counter

Independent lab · 2h

6. run_sim.sh: compile/run/log
7. clean.sh
8. setup_env.sh
9. Timestamp regression outputs
10. Simple Makefile target flow

Debug and assignment · 1h

Debug a broken shell script
Create one-command simulation flow

Expected deliverable

Reusable simulation automation scripts

Practical work

Automate a repeatable command-line simulation workflow using Bash and a simple Makefile flow.

Setup
  1. Work under project_workspace/scripts and project_workspace/logs.
  2. Use executable shell scripts with a valid shebang.
  3. Do not hard-code machine-specific absolute paths.
Execution steps
  1. Create hello.sh and verify execution permissions.
  2. Read command-line arguments and validate missing input.
  3. Check whether an input file exists and return a meaningful exit status.
  4. Loop through .v files and print the discovered list.
  5. Count PASS and FAIL entries in a sample log.
  6. Create run_sim.sh with compile, run and log stages.
  7. Create clean.sh and setup_env.sh.
  8. Add timestamps to regression output directories.
  9. Create a simple Makefile target that invokes the workflow.
Debug challenge

Repair the broken shell script supplied by the instructor and demonstrate one-command execution of the corrected flow.

Evidence to retain
  • hello.sh
  • run_sim.sh
  • clean.sh
  • setup_env.sh
  • Makefile
  • sample log and PASS/FAIL summary
Completion criteria
  • Scripts return sensible exit status
  • One command runs the intended flow
  • Generated output is stored under project_workspace