Completed bash_basics assignment#235
Completed bash_basics assignment#235MarcquellaUmiDillon wants to merge 5 commits intoRahafB:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes the bash_basics assignment by adding the “create an empty file from user input” exercise implementation and including placeholder files used in the parallel/merge workflow portion of the assignment.
Changes:
- Added a prompt/read flow to capture a filename and create the file in
01-read_input.sh. - Added empty placeholder files (
test.txt,parallel.txt) likely used for the branching/merge exercises.
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| 01-read_input.sh | Adds filename prompt + file creation step for the exercise. |
| test.txt | Empty placeholder file added for assignment workflow. |
| parallel.txt | Empty placeholder file added for assignment workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "Enter a filename (parallel version):" | ||
| read filename | ||
| touch $filename |
There was a problem hiding this comment.
read filename should use read -r to avoid backslash escape processing, and touch $filename should quote the variable (and preferably use --) to prevent word-splitting/globbing and option-like filenames (e.g., a name starting with -) being misinterpreted.
| touch $filename | ||
| echo "Your file $filename was successfully created in the parallel universe!" |
There was a problem hiding this comment.
Using touch will not necessarily "create an empty file" if the file already exists (it will just update timestamps). If the exercise requires guaranteeing an empty file, add an existence check and/or truncate the file explicitly (while handling the risk of overwriting).
| touch $filename | |
| echo "Your file $filename was successfully created in the parallel universe!" | |
| if [ -e "$filename" ]; then | |
| echo "Warning: $filename already exists and will be emptied." | |
| fi | |
| : > "$filename" | |
| echo "Your empty file $filename was successfully created in the parallel universe!" |
Completed Part II: Parallel universes and Part III: U.N. conflict resolution including branching, parallel edits, and merge conflict resolution.