Linux Shell Scripting Quiz Challenge | Linux Shell Scripting Interview questions and answers
💻 Linux Shell Scripting Challenge
Test your knowledge of Bash syntax, control structures, and essential scripting commands. **Pass with 80% to proceed to the next difficulty level.**
Syntax & Variables: 0/10 (0%)
Control Flow: 0/10 (0%)
Functions & Advanced: 0/10 (0%)
Level 1: Basic Syntax and Variables
1.1 What is the correct "shebang" line to start a script that uses the Bash shell?
**Correct Answer: B. `#!/bin/bash`**. The **shebang** line is `#!` followed by the absolute path to the interpreter (Bash).
**End of Basic Syntax. Click "Next Level" to continue.**
Level 2: Control Flow and Loops
2.1 What is the correct way to start an `if` condition that checks if a variable `COUNT` is equal to 10 using the standard test command?
**Correct Answer: B.** The **`-eq`** operator is used for **numeric equality** inside single square brackets (`[` or `test`). Spaces are mandatory.
**End of Control Flow. Click "Next Level" to continue.**
Level 3: Functions and Advanced Concepts
3.1 What is the correct way to define a function named `cleanup` in Bash?
**Correct Answer: C. `cleanup () { ... }`**. This is the standard POSIX shell function definition format. `function cleanup { ... }` is also valid in Bash but less portable.
**Shell Scripting Mastered! Click "Finish Quiz" to see your final summary.**
Comments
Post a Comment