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
- Work under project_workspace/scripts and project_workspace/logs.
- Use executable shell scripts with a valid shebang.
- Do not hard-code machine-specific absolute paths.
Execution steps
- Create hello.sh and verify execution permissions.
- Read command-line arguments and validate missing input.
- Check whether an input file exists and return a meaningful exit status.
- Loop through .v files and print the discovered list.
- Count PASS and FAIL entries in a sample log.
- Create run_sim.sh with compile, run and log stages.
- Create clean.sh and setup_env.sh.
- Add timestamps to regression output directories.
- 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