The Life Starter
0 of 6 complete0%
Course Library · Lesson 5 of 6
Digital · Guided lesson

Save a repeatable script

About 31 minutes · 6 reading + 25 practice and checks
Time includes reading, practice, and questions. Extra videos or further study are optional.
See this course’s project requirements

A repeatable Bash workflow with checked registration counts, a controlled rerun and clear handoff instructions.

Keep your working files in your own notebook or software. Save a private description, checklist, and work link in My Proof.

What to include

  • Location and path log.
  • Raw-row count with header handling.
  • Confirmed counts by session.
  • Reviewed script and dedicated output path.
  • Baseline/variation results and handoff.

Review and revise

Use these criteria to check your work and choose what to improve.

  • Paths and quoting are accurate.
  • Counts reconcile with the fixture.
  • Raw data is preserved.
  • Rerun and limitations are explained.
Open the full course project
Want more background?
Before you begin

The idea in everyday life

Summarize fictional workshop registrations using Bash and a small tab-separated file.

The idea

A script is saved command text; repeatability also depends on readable inputs and location.

Follow along

Save a repeatable script — guided practice

Turn the checked pipeline into a script that writes a dedicated result file.

Create an empty shell-lab folder. Inside it create input and output folders. Put registrations.tsv in input with these tab-separated rows and a final newline: session<TAB>status; art<TAB>confirmed; code<TAB>confirmed; art<TAB>waiting; code<TAB>confirmed; music<TAB>confirmed. Start the terminal in shell-lab. Bash required; no sudo, remote systems or deletion commands. Put the supplied summarize.sh in shell-lab. It changes to its own folder before reading input. Do not run downloaded unknown scripts.

  1. 1. Read before running

    Open summarize.sh and identify its input and output paths.

    You should see: It checks that input/registrations.tsv is readable before writing output/confirmed.txt.

    Reviewing a script reveals its effects before execution.

  2. 2. Run with Bash

    Execute bash summarize.sh from shell-lab.

    bash summarize.sh

    You should see: The command finishes and output/confirmed.txt exists.

    Explicit Bash avoids relying on execute permissions.

  3. 3. Inspect saved output

    Print output/confirmed.txt.

    cat output/confirmed.txt

    You should see: Counts are art 1, code 2 and music 1.

    Successful execution alone does not prove useful output.

  4. 4. Explain redirection

    Write that > replaces this dedicated output file on each run.

    You should see: The script recreates one report rather than appending duplicates.

    The target must be disposable output, never the raw input.

Now change one thing

A report has 3 lines. The script writes the same report twice using >. How many report lines remain?

Your work

What to finish

A reviewed summarize.sh and checked output file.

Common mistake

Watch for this

Redirecting a command’s output to its own input path can destroy the input before it is read.

How can I tell I understand it?

Complete the changed case, explain your result, and pass the three application checks.

Try 3 questions

Quick knowledge check

Answer all 3 questions. Get at least 2 right and the lesson completes automatically.

Not yet passed

You’ll get an explanation for each answer. Signed in? Your results save to your account.

1A pipeline reads raw.tsv. Which output target is appropriate?
2What does >> do compared with >?
3A script works only when launched from one folder. What dependency should its handoff state or remove?
0 of 3 answeredApply the lesson to a short question, then review the explanation.
5
Finish this lesson

Pass the check. We’ll save the progress.

Answer all 3 questions above and get at least 2 right. You can review the explanations and try again.

Go to the knowledge check
Optional course overview video · same video as Lesson 1
Missing SemesterLecture 1: Course Overview + The Shell (2020)YouTube
Optional course overview

Lecture 1: Course Overview + The Shell (2020)

From Missing Semester. Watch here or open it on YouTube .

Optional course overview. Follow the written steps below at your own pace.
Tools, templates, and lesson sources

Tools and templates

Tools open in a new tab so you can keep your place here.

Sources and further reading

Explore the references behind this lesson.

MIT Missing Semester: Course Overview and the Shell
Source & access notes · checked 2026-09-12

Opened and inspected on 2026-09-12: Arguments, paths and input/output.

Access: Free public web page; no paid enrollment required.

Reuse: CC BY-NC-SA; link only.

Software Carpentry: Pipes and Filters
Source & access notes · checked 2026-09-12

Opened and inspected on 2026-09-12: Sorting, counts, pipes and redirection.

Access: Free public web page; no paid enrollment required.

Reuse: CC BY 4.0 instruction; MIT examples. Independent fixture used.

Report a problem with this lesson

Tell us what went wrong. Please leave out personal information and private project contents.

No sign-in needed.