How do I get input in bash?

Trần Vũ

New member
How do I get input in bash?
Answer
To read the Bash user input, we use
the built-in Bash command called read.
…
Program:
  1. #!/bin/bash.
  2. # Read the user input.
  3. echo “Enter the user name: “
  4. read first_name.
  5. echo “The Current User Name is $first_name”
  6. echo.
  7. echo “Enter other users’names: “
  8. read name1 name2 name3.
 

Tìm kiếm

Back
Top