Gabriel Turqos
Active Member
- Joined
- Mar 11, 2019
- Messages
- 17
- Thread Author
- #1
read
command. Here's how you can use it in your script: bash # Prompt for user input echo "Please enter your name:" read name # Output the input value echo "Hello, $name! Welcome to the script."
bash # Display message and read input on the same line read -p "Enter your age: " age echo "You entered: $age"
bash # Prompt for password read -s -p "Enter your password: " password echo # For a new line after password entry # Use the password securely (e.g., not...
read
command. Here's how you can use it in your script: bash # Prompt for user input echo "Please enter your name:" read name # Output the input value echo "Hello, $name! Welcome to the script."
bash # Display message and read input on the same line read -p "Enter your age: " age echo "You entered: $age"
bash # Prompt for password read -s -p "Enter your password: " password echo # For a new line after password entry # Use the password securely (e.g., not printing or processing it)
bash # Prompt for multiple inputs read -p "Enter your first name: " first_name read -p "Enter your last name: " last_name # Output the inputs echo "Hello, $first_name $last_name! Welcome to the script."
read
command is versatile and allows for efficient user input handling in your script.