Bird
0
0

Which of the following is the correct syntax to silently read a password with a prompt in bash?

easy📝 Syntax Q12 of 15
Bash Scripting - User Input
Which of the following is the correct syntax to silently read a password with a prompt in bash?
Aread -p "Enter password:" password -s
Bread password -p -s "Enter password:"
Cread -s -p "Enter password:" password
Dread password -s -p "Enter password:"
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct option order for read

    The options -s and -p must come before the variable name.
  2. Step 2: Check each option's position

    read -s -p "Enter password:" password correctly places -s and -p before the variable password.
  3. Final Answer:

    read -s -p "Enter password:" password -> Option C
  4. Quick Check:

    Options before variable = correct syntax [OK]
Quick Trick: Options (-s, -p) always come before variable name [OK]
Common Mistakes:
MISTAKES
  • Placing options after variable name
  • Mixing order of -s and -p incorrectly
  • Using -p without quotes for prompt

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes