shell 键盘输入

时间:2021-08-02 15:20:27

命令:read 从键盘读入数据,赋值变量

[root@ssgao shell]# cat b.sh
#!bin/bash
read a b c
echo "a is : ${a}"
echo "b is : ${b}"
echo "c is : ${c}"
-------------------上面的输出信息--------------
[root@ssgao shell]# sh -x b.sh // -x 表示进行跟踪执行
+ read a b c //执行到read a b c
10 20 30
+ echo 'a is : 10'
a is : 10
+ echo 'b is : 20'
b is : 20
+ echo 'c is : 30'
c is : 30