-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
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
- Not run the commands Nelle runs
rm -rf stats-*.txtbetween each command, without being prompted
I see multiple options to solve this:
- 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
- Make the error message more helpful, instead of
error writing result, maybe sayfile already exists, and maybe prompt them to delete it? - Add special-case exceptions; for example if
$2doesn't matchNENE*.txtallow it to be overwritten. Or, more strictly, allow onlystats-*.txtto be overwritten
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels