其他分享
首页 > 其他分享> > Sheel 脚本接收键盘输入

Sheel 脚本接收键盘输入

作者:互联网

一、通过read 接收

1. 通过vim 定义一个test.sh的脚本

vim test.sh

2. 编写shell脚本

#! /bin/bash
read name
echo "$name It is a test"

3. 添加脚本执行权限

chmod +x test.sh 

4. 执行脚本

[root@test-29 ~]# ./test.sh 
OK
OK It is a test

 

标签:脚本,OK,read,键盘输入,vim,sh,test,接收,Sheel
来源: https://www.cnblogs.com/dairenblog/p/14406049.html