Mission 346

Script input guard

Use test checks to prove required files and directories exist.

Shell scripting
8 minutes Admin Lesson 346 of 360
teststat
Lesson 346 of 360 0/360 lessons 0/17 missions Shell scripting · 8 minutes
0%
Continue View profile
Ops lab terminal Training lab
New learnerrank 0XP 0%complete
learner@clairos:/home/learner $ Unix ops lab: type a command, press Enter
Instructions 8 minutes

Click any instruction for the command details, the why, and the common mistake to avoid.

Check the script file

Run test -f scripts/deploy.sh.

test -f scripts/deploy.sh
Check the output directory

Run test -d lab.

test -d lab
Inspect the guarded input

Run stat scripts/deploy.sh.

stat scripts/deploy.sh
Lesson support

What to notice while you play.

Objective

Build repeatable confidence with guarding script-style work with explicit preconditions.

Hint

Start with test -f scripts/deploy.sh, inspect the result, then continue in order.

Why it matters

Guarding script-style work with explicit preconditions helps operators explain what they know before they change anything.

Common mistakes
  • Skipping the output that proves guarding script-style work with explicit preconditions.
  • Changing several things before recording a baseline.
Reference

Commands in this lesson.

test -e|-f|-d <path>

Check path type in a training-friendly way.

stat <path>

Show lab file details.