Recall & Review
beginner
What does the
-s option do in the read command in bash?The
-s option makes the input silent, so what you type is not shown on the screen. This is useful for entering passwords.Click to reveal answer
beginner
How can you prompt a user to enter a password silently in bash?
Use
read -s -p "Enter password: " password. The -p shows the prompt, and -s hides the input.Click to reveal answer
beginner
Why is silent input important when asking for passwords?
Silent input prevents others from seeing your password on the screen, protecting your privacy and security.
Click to reveal answer
intermediate
What happens if you use
read -s without -p?The input will be silent, but no prompt message will be shown. The user might not know what to type.
Click to reveal answer
beginner
How can you make sure the user pressed Enter after typing a silent password?
The
read command waits for Enter by default, so after typing the password silently, pressing Enter submits the input.Click to reveal answer
What does the
-s option do in the bash read command?✗ Incorrect
The
-s option makes the input silent, so the characters typed are not displayed on the screen.Which command correctly prompts for a password silently with a message?
✗ Incorrect
The correct syntax is
read -s -p "Password: " password where -s hides input and -p shows the prompt.What will happen if you use
read -s password without -p?✗ Incorrect
Without
-p, no prompt message appears, but input is still silent.Why is it important to use silent input for passwords?
✗ Incorrect
Silent input hides the password on screen, protecting it from being seen by others.
After typing a password silently with
read -s, how does the user submit the input?✗ Incorrect
The user presses Enter to submit the input after typing silently.
Explain how to use the
read command to get a password silently from a user in bash.Think about hiding input and showing a prompt.
You got /4 concepts.
Why should you use silent input when asking for passwords in scripts?
Consider what happens if someone looks at your screen.
You got /4 concepts.