Bird
0
0

Given a script hello.sh without execute permission, what will be the output of the command sequence below?

medium📝 Command Output Q13 of 15
Bash Scripting - Basics
Given a script hello.sh without execute permission, what will be the output of the command sequence below?
ls -l hello.sh
chmod +x hello.sh
ls -l hello.sh
ABoth <code>ls -l</code> commands show execute permission.
BThe first <code>ls -l</code> shows no execute permission; the second shows execute permission added.
CThe first <code>ls -l</code> shows execute permission; the second removes it.
DBoth <code>ls -l</code> commands show no execute permission.
Step-by-Step Solution
Solution:
  1. Step 1: Understand initial permissions

    Initially, hello.sh has no execute permission, so ls -l shows no 'x' in permissions.
  2. Step 2: Apply chmod +x and check again

    After running chmod +x hello.sh, execute permission is added, so the second ls -l shows 'x' in permissions.
  3. Final Answer:

    The first ls -l shows no execute permission; the second shows execute permission added. -> Option B
  4. Quick Check:

    Adding +x updates permissions visible in ls -l [OK]
Quick Trick: Check permissions before and after with ls -l [OK]
Common Mistakes:
MISTAKES
  • Assuming execute permission is present initially
  • Thinking chmod +x removes execute permission
  • Not noticing permission changes in ls -l

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes