DotLinux.net
Toggle Menu
Home
Topics
Linux Basics
Command Line
Shell Scripting
Networking
Security
Administration
Blogs
Latest Blogs
Quizzes
Disk and Storage Management
File System and Permissions
Linux Command Line Basics
Linux Environment and Variables
Networking Fundamentals
Package Management
Process and System Monitoring
Shell Scripting Basics
System Boot and Services
User and Group Management
Tools
Online Bash Compiler
About
Shell Scripting Basics
Evaluate understanding of simple Bash scripts and automation.
1. What is the correct shebang line to specify a bash shell script?
#!/bin/sh
#!/bin/bash
#!bash
#/bin/bash
2. Which of the following are valid loop structures in shell scripting? (Select all that apply)
for
while
until
do-while
3. In shell scripting, variable assignment requires spaces around the '=' sign (e.g., var = 5).
True
False
4. What command is used to read user input from the terminal into a variable?
5. Which operator is used for arithmetic expansion in bash?
$[]
$()
$(( ))
${ }
6. Which of the following are valid file test operators in shell scripting? (Select all that apply)
-f
-d
-x
-z
7. The exit status of a successful command in shell is 0.
True
False
8. What is the abbreviation for the Portable Operating System Interface standard that shell scripts often adhere to?
9. Which command is used to change the permissions of a file?
chown
chmod
chgrp
chperm
10. Which of the following are valid input/output redirection operators? (Select all that apply)
>
<
|
>>
11. The 'case' statement in shell scripting is used for multiple conditional checks.
True
False
12. What symbol is used to comment a line in a shell script?
13. What does the '$?' variable represent in shell scripting?
Current working directory
Exit status of the last command
Number of arguments
Home directory
14. Which of the following are valid arithmetic operators in bash? (Select all that apply)
+
-
*
/
%
15. Wildcards like '*' and '?' can be used in shell scripts to match filenames.
True
False
16. What command is used to display the current working directory?
17. Which loop is used to iterate over a list of items in shell scripting?
while
until
for
do-while
18. Which of the following are valid comparison operators for numeric values in shell conditionals? (Select all that apply)
-eq
-ne
-gt
-lt
==
19. Shell functions must be defined before they are called in a script.
True
False
20. What is the default shell for most Linux systems, often used for scripting?
Reset
Answered 0 of 0 — 0 correct