Reading User Input
Interactive user input is a vital feature if your scripts are going to provide rich functionality. To facilitate this sort of data capture, we use the read
command:
#!/bin/bash
echo "What is your name"
read name
echo "Hello $name"
#!/bin/bash
read -p 'Username: ' username
read -sp 'Password: ' password
echo "Hello $username, your password is now set to $password"

Last updated
Was this helpful?