0
0
Bash Scriptingscripting~5 mins

Why input makes scripts interactive in Bash Scripting - Quick Recap

Choose your learning style9 modes available
Recall & Review
beginner
What does it mean when a script is interactive?
An interactive script asks the user for information while it runs, instead of running all by itself without stopping.
Click to reveal answer
beginner
How does the read command in bash make a script interactive?
The read command pauses the script and waits for the user to type something. This input can then be used later in the script.
Click to reveal answer
beginner
Why is user input important in scripts?
User input lets scripts do different things depending on what the user wants, making scripts flexible and useful in many situations.
Click to reveal answer
beginner
What happens if a script does not use input commands?
The script runs automatically without stopping, using only the information it already has. It cannot change behavior based on user choices.
Click to reveal answer
beginner
Give an example of a simple interactive bash script.
Example:
#!/bin/bash

echo "What is your name?"
read name
echo "Hello, $name!"
This script asks for your name and then greets you.
Click to reveal answer
What command in bash is commonly used to get user input?
Aecho
Bread
Cls
Dcd
Why would you want a script to be interactive?
ATo make the script shorter
BTo run faster without stopping
CTo ask the user for information during the script run
DTo avoid using variables
What happens if a script uses no input commands?
AIt runs without stopping and uses preset data
BIt waits for user input anyway
CIt crashes immediately
DIt asks for input by default
Which of these is NOT a reason to make a script interactive?
ATo customize behavior based on user input
BTo make the script flexible
CTo get information from the user
DTo automate repetitive tasks without user help
In the example script: read name, what does name represent?
AA variable to store user input
BA command to print text
CA file name
DA script name
Explain in your own words why input makes a script interactive.
Think about how a conversation works between you and the script.
You got /3 concepts.
    Describe a simple scenario where an interactive script is better than a non-interactive one.
    Imagine ordering coffee with or without telling the barista your preferences.
    You got /4 concepts.