Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions 01-read_input.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ echo 'Your name was stored in $name'

# exercise: write a script that asks the user for a
# filename and create an empty file named after it

echo "Enter a filename (parallel version):"
read filename
touch $filename
Comment on lines +14 to +16
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
echo "Your file $filename was successfully created in the parallel universe!"
Comment on lines +16 to +17
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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!"

Copilot uses AI. Check for mistakes.

Binary file added after_merge_graph.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added network_graph.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added parallel.txt
Empty file.
Empty file added test.txt
Empty file.