CertGrid CertGrid
Hands-on Lab·LPIC-1

Tests, loops, and the options that catch mistakes

Most scripting marks are lost on the test command, not on loops. This guide works through the file and string operators, shows the difference between numeric and string comparison - including a comparison that errored under the capture's shell and what that tells you - and finishes with set -euo pipefail proving its worth against the same script without it.

102: Shells and Scripting Guide 14 of 33 Beginner

One Debian-family host. Every script is created inside a directory the page makes and removes; nothing is installed and nothing outside that directory is touched.
Server NameIP AddressOSRolesCPURAMHDD
LPIC1-A01192.168.0.76Ubuntu 26.04 LTSDebian-family host - dpkg and apt, which objective 102.4 names2 Core4 GB50 GB

This guide includes

Use this because most scripting marks are lost on the test command rather than on loops. This matters because numeric and string comparison disagree - and one of them errors on input the other accepts quietly.

Before you start

  1. The operators the exam actually asks about

  2. Numeric against string, and a comparison that errored

  3. Loops, and arguments with spaces in them

  4. The two lines that turn a silent failure loud

Official sources