Examers.io
ExamsOrganizationsHow it worksPricingHelp & FAQ
Linux Professional Institute logo

LPI Linux Essentials (010-160)

Domain 3Objective 3

3.3 Turning Commands into a Script (weight: 4) LINUX-ESSENTIALS Practice Questions (Page 6)

Part of the Topic 3: The Power of the Command Line domain, which makes up ~16% of our current practice bank. Linux Professional Institute does not publish an official question count, but from its 60-minute exam (~25–40 total, ~4–6 in this domain), expect 1–2 from this objective — we provide 36 practice questions to prepare you well beyond it. (estimate)

36questions here
8free pages
9concepts

Questions 26–30

  1. 26expert · hard

    A script is written with a shebang '#!/bin/bash' and saved with execute permissions. When run directly, it works. However, when run with 'sh script.sh', it fails with a syntax error. What is the most likely reason?

    Select an answer first
  2. 27expert · medium

    A script must check if a number is greater than 10 and less than 20. The admin writes: 'if [ $num -gt 10 -a $num -lt 20 ]; then ...'. The script works, but the admin wants to make it more readable and portable. Which alternative is best?

    Select an answer first
  3. 28expert · hard

    A script sets a variable 'MYVAR' and then uses it in a command. The script works when run manually, but when run from cron, the variable is empty. What is the most likely cause?

    Select an answer first
  4. 29application · easy

    A system administrator writes a script that needs to store the current date in a variable named 'TODAY' and then use it to create a backup directory. The script currently has the line 'TODAY=date'. When run, the variable contains the literal string 'date' instead of the actual date. Which change should the admin make?

    Select an answer first
  5. 30application · medium

    A DevOps engineer writes a script that checks if a configuration file exists before proceeding. The script uses 'if [ -f /etc/app.conf ]; then' but the file is actually a directory. The script incorrectly proceeds. What is the most likely reason?

    Select an answer first
Finished these 5 questions?

Review the revealed explanations, or continue through the curriculum.

Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by Linux Professional Institute. “LINUX-ESSENTIALS” is a trademark of its owner, used for identification only.