What you will build
Step 1: Write stamp.sh
Write stamp.sh so that it prefixes each line of standard input with the current time in HH:MM:SS. It also accepts an optional file name to read instead of standard input, and exits with status 1 with a message on standard error if that file cannot be read. Keep each line exact, then run it on three lines, one of which is indented:
printf 'first\n indented\nlast\n' | bash stamp.sh > stamped.txtThe output must have three lines, and the indented line must keep its two leading spaces after the time.
Step 2: Check the missing-file path
Run the logger on a file that does not exist. Save its standard output, its standard error, and its status:
bash stamp.sh nope.txt > m.out 2> m.err
echo $? > m.statusThe status should be 1, the standard output should be empty, and the error should be on standard error.
Files
stamp.sh: the finished script.walkthrough.sh: every step of the reference solution, in order.
How it is checked
Each step in the guided lab has a check script that runs on the lab machine after you finish. It passes only when the files and output it expects are there, so the lab cannot be completed by reading alone.