Shell Scripting MCQ Test: Shell Scripting MCQs - Practice Questions
1. How do you iterate over a list of items in a shell script?
2. What is the purpose of the 'awk' command in shell scripting?
3. What does the 'tee' command do in a shell script?
4. In a shell script, how do you check if a file exists before performing an operation?
5. What is the purpose of the 'wait' command in advanced shell scripting?
6. What is the purpose of the 'shopt' command in advanced shell scripting?
7. In a shell script, how do you concatenate two strings?
8. What command is used to list the contents of a directory in a shell script?
9. In a shell script, how do you check the current date and time?
10. Explain the significance of the 'readonly' command in advanced shell scripting.
11. Explain how to perform error handling for a command within a pipeline in a shell script.
12. How do you check the exit status of the last command in a shell script?
13. How do you handle concurrency in a shell script?
14. What is the purpose of the 'basename' command in shell scripting?
15. What is the purpose of the 'history' command in a shell script?
16. Which command is used to remove a file in a shell script?
17. What is the purpose of the 'echo' command in a shell script?
18. How do you check the version of the shell in a shell script?
19. How do you declare and use a variable in a shell script?
20. What is the purpose of the 'case' statement in shell scripting?
21. How can you perform a non-blocking read from a file descriptor in a shell script?
22. Explain how to implement logging in a shell script for debugging purposes.
23. Explain how to handle signals in a shell script for graceful termination.
24. Which command is used to display the contents of a file in a shell script?
25. How do you redirect the standard error stream in shell scripting?
26. How do you read input from the user in a shell script?
27. How can you perform floating-point arithmetic in a shell script?
28. What is the purpose of the 'eval' command in advanced shell scripting?
29. What does the 'shift' command do in shell scripting?
30. What does the 'declare' command do in shell scripting?
31. How do you check if a variable is set in a shell script?
32. What is the purpose of the 'shebang' (#!) in the first line of a shell script?
33. How can you implement error handling in a shell script for better debugging?
34. How can you create a timestamp in a shell script?
35. How can you pass command-line arguments to a shell script?
36. Which command is used to create a new directory in a shell script?
37. What is the purpose of the 'declare' command with the '-a' option in advanced shell scripting?
38. In a shell script, how do you check if a variable is empty?
39. What is the purpose of the 'source' command in advanced shell scripting?
40. What command is used to display the manual for a command in a shell script?