[bash:read] user input

ref

sometimes you want to insert specific values by yourself during script running.

This function is useful for it

just add “read”

e.g. for inserting age in vi editor.

=========================================

#!/bin/bash

echo “how old is he?”

read age

echo “he is $age years old”

=========================================

e.g.2 for inserting serveral values.

echo “what numbers are is your favorite?”

read num1 num2 num3

echo “you said $num1, $num2, $num3”

=========================================

So, Simple 🙂

 

 

 

 

Advertisements