Quiz · 5 questions
📜 Shell Scripting
Variables, loops, conditionals, functions, error handling
Level 0Window Tourist
0 XP0/95 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete
Quiz
01Why prefer
#!/usr/bin/env bash over #!/bin/bash?Hint
It tells the kernel which interpreter should run the file.
02Why does
for f in $files break with filenames that contain spaces?Hint
One form preserves spaces and newlines as a single token.
03What does
set -euo pipefail give you?Hint
Three letters that turn shell scripts from optimistic to defensive.
04What's the safest way to expand all elements of an array
arr?Hint
One starts arrays at index 1 by default; the other at 0.
05Why use
trap '...' EXIT to clean up a temp directory rather than calling rm -rf at the end of the script?Hint
Quoting the delimiter disables variable expansion inside the body.
Comments 0
🔔 Reply notifications (sign in)Sign in — Please sign in to comment.
No comments yet — be the first.