Languages
[Edit]
EN

Bash - read variable from command line

3 points
Created by:
Amir-Hashempur
607

In this article, we would like to show you how to read variable from command line in Bash.

Quick solution:

 

Practical example

Edit

In this example, we use read command with -p option to print the message before reading the value from command line. Then we set value as variable and print it using echo command.

 

See also

Edit
  1. Bash - read password in script without displaying characters

Alternative titles

  1. Bash - read variable from cmd
  2. Bash - read variable from terminal
  3. Bash - reading user input
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join