Script Valley
Bash Scripting for Developers
Shell Fundamentals/Assessment

Practice & Assessment

Test your understanding of Shell Fundamentals

Multiple Choice Questions

5
1

What does `set -o pipefail` do in a Bash script?

2

Which quoting style prevents ALL variable expansion in Bash?

3

What is the exit code convention for a successful command in Bash?

4

What does `2>&1` mean in a Bash redirect?

5

Which syntax is preferred for command substitution in modern Bash?

Coding Challenges

1
1

System Info Reporter

Write a Bash script `sysinfo.sh` that collects and prints: hostname, current user, OS name, total RAM in MB, number of CPUs, and disk usage percentage of `/`. Each item should print on its own labeled line (e.g., `Hostname: myserver`). Use command substitution for every value. The script must include `set -euo pipefail` and work on both Linux and macOS. Input: none. Output: 6 labeled lines to stdout. Time estimate: 15-20 minutes.

Easy

Mini Project

1

Bootstrap Script Generator

Build a script `bootstrap.sh` that sets up a fresh developer environment. It must: accept a `--lang` argument (node, python, or go) and a `--dir` argument for the project directory; create the directory structure using variables and command substitution; write a language-appropriate starter file (e.g., `index.js`, `main.py`, `main.go`) using a heredoc; log all actions with timestamps to `bootstrap.log` using tee; exit with a clear error message and code 1 if required args are missing or the language is unsupported. Use `set -euo pipefail` and `trap` for cleanup on failure.

Medium
Practice & Assessment โ€” Shell Fundamentals โ€” Bash Scripting for Developers โ€” Script Valley โ€” Script Valley