Writing Bash Scripts – quiz with 15 questions

Robust shell scripts for Linux: shebang, variables and quotation marks, exit codes, tests, loops and case, redirections, set -euo pipefail, trap, cron, and ShellCheck.

Questions
15
Level
Intermediate
Area
IT & Cloud · Linux & DevOps

Modules

Sample question

Wozu dient die erste Zeile #!/usr/bin/env bash in einem Skript?

  • Sie ist ein reiner Kommentar, den die Shell überspringt, aber Editoren nutzen
  • Sie macht die Datei für alle Benutzer ausführbar, ohne chmod
  • Sie lädt Umgebungsvariablen aus dem Profil neu, bevor das Skript startet
  • Sie legt den Interpreter fest (Shebang)

Correct: Sie legt den Interpreter fest (Shebang). Beim Start mit ./skript.sh liest der Kernel die Shebang-Zeile. Ausführbar wird die Datei erst mit chmod +x.

More questions from the quiz

  • Was ist an der Zuweisung name = "Anna" in Bash falsch?
  • Warum schreibt man Variablen in Bash als "$datei" in Anführungszeichen?
  • Was enthält die Variable $? direkt nach einem Befehl?
  • Wie speicherst du das heutige Datum im Format JJJJ-MM-TT in einer Variable?
  • Welcher Test prüft, ob /etc/app.conf existiert und eine reguläre Datei ist?

The questions and explanations are in German – checked by experts, not machine-translated.

After every answer, Quizbot explains why it is right or wrong. Open questions come first, and progress is counted per topic. The quiz is free of charge; no account is needed.

As of 15.11.2026 · All quizzes

Quizbot – a project by AI SYSTEM, St. Gallen · Home