Courseiva
GNU and Unix CommandshardMultiple SelectObjective-mapped

LPIC-1 GNU and Unix Commands Practice Question

Which TWO of the following are valid methods to run a shell script named 'script.sh' using the bash shell, assuming the script has execute permission? (Choose two.)

⚠ Common exam trap

Test-takers frequently confuse 'sh script.sh' with 'bash script.sh', not realizing that sh may be a different shell (e.g., dash) that lacks bash-specific features, and that 'source' is for importing functions/variables, not for running a script as a separate process.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

./script.sh

'./script.sh' explicitly invokes the script using the current shell's shebang interpreter (e.g., #!/bin/bash) and requires execute permission. Option E is correct because 'bash script.sh' runs the script as an argument to the bash interpreter, which reads and executes the file line by line, also requiring execute permission.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ./script.sh

    Why this is correct

    Executes the script using its shebang line, assumed to be bash.

  • sh script.sh

    Why it's wrong here

    Runs with sh, not necessarily bash.

  • script.sh (if in PATH)

    Why it's wrong here

    Same as ./script.sh but requires PATH; still uses shebang.

  • source script.sh

    Why it's wrong here

    Sources the script into the current shell, not a separate process.

  • bash script.sh

    Why this is correct

    Explicitly runs with bash.

About these practice questions

This LPIC-1 question is part of Courseiva's 527-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.