Bird
0
0

You want to create a script backup.sh that prints "Backup started" and then lists files in the current directory. Which script content is correct?

hard🚀 Application Q15 of 15
Bash Scripting - Basics
You want to create a script backup.sh that prints "Backup started" and then lists files in the current directory. Which script content is correct?
A#!/bin/bash echo "Backup started" ls
Becho "Backup started" ls #!/bin/bash
C#!/bin/bash echo Backup started ls-l
D#!/bin/sh echo "Backup started" list
Step-by-Step Solution
Solution:
  1. Step 1: Check the shebang and commands order

    The script must start with #!/bin/bash to run in bash, then commands follow in order.
  2. Step 2: Verify commands and syntax

    #!/bin/bash echo "Backup started" ls has correct shebang, echo with quotes, and ls command to list files. Others have wrong order, missing quotes, or invalid commands.
  3. Final Answer:

    #!/bin/bash echo "Backup started" ls -> Option A
  4. Quick Check:

    Correct script structure = #!/bin/bash echo "Backup started" ls [OK]
Quick Trick: Start script with #!/bin/bash then commands line by line [OK]
Common Mistakes:
MISTAKES
  • Placing shebang after commands
  • Using wrong commands like 'list'
  • Missing quotes around strings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes