🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Bash Scripting for DevOps: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What exit code means a command succeeded?
  2. Q2. In npm test && npm run build, when does the build run?
  3. Q3. Which line correctly creates a variable in bash?
  4. Q4. A variable file holds exam marks.txt. Why is rm "$file" safer than rm $file?
  5. Q5. What does set -e do in a script?
  6. Q6. Why is set -o pipefail useful?
  7. Q7. What does the cron line 30 2 1-5 /home/deploy/backup.sh mean?
  8. Q8. What does this print? (code)
  9. Q9. The health-check script prints "ALERT" and then runs exit 1. Why does the exit code matter?
  10. Q10. A cron job works when you run it by hand but does nothing from cron. What is a likely cause?