CertGrid CertGrid
Hands-on Lab·LPIC-1

Variables, scope and exit status

Objective 105 is shell customisation and scripting, and two ideas carry most of it: a script runs in a child process unless you source it, and the only thing a caller learns is the exit status. This guide demonstrates both by running the same script three ways and watching whether a change escapes.

102: Shells and Scripting Guide 13 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 for the two ideas that carry the scripting objective. This matters because the shebang decides which shell runs your script - not the one you logged in with, which on these hosts is zsh.

Before you start

  1. The shebang decides, not your login shell

  2. Scope, demonstrated three ways

  3. Exit status is the only thing a caller sees

Official sources