Skip to content

Presence checks from PR #1487 cause errors when following steps verbatim #1508

@AlexCK-STFC

Description

@AlexCK-STFC

What is the problem?

The presence check for argument 2, i.e. "stats-*.txt" already existing from #1487, frequently cause errors like error writing result: stats-NENE01729A.txt when following the steps verbatim.

I.e. consider in the Shell Scripts lesson, following Nelle's steps verbatim, learners following along with Nelle's bash history would run, in order:

bash do-stats.sh NENE*A.txt NENE*B.txt
bash do-stats.sh NENE*A.txt NENE*B.txt | wc -l

The second will fail as the stats files already exist.

This same issue comes up many times in the Loops and Shell Scripts pages

Learners either have to

  1. Not run the commands Nelle runs
  2. rm -rf stats-*.txt between each command, without being prompted

I see multiple options to solve this:

  1. Revert the presence check for $2 and allow the script to overwrite files. Perhaps instruct learners to backup the files, as is done for the creatures in the Loops lesson
  2. Make the error message more helpful, instead of error writing result, maybe say file already exists, and maybe prompt them to delete it?
  3. Add special-case exceptions; for example if $2 doesn't match NENE*.txt allow it to be overwritten. Or, more strictly, allow only stats-*.txt to be overwritten

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions