当前位置:网站首页>Shell的read 读取控制台输入、read的使用
Shell的read 读取控制台输入、read的使用
2022-07-27 09:49:00 【Redamancy06】
1.read 读取控制台输入
read 是 Shell 内置命令,用来从标准输入中读取数据并赋值给变量。如果没有进行重定向,默认就是从键盘读取用户输入的数据;如果进行了重定向,那么可以从文件中读取数据。
1.1基本语法
read (options) (variables)
options表示选项,如下表所示;
variables表示用来存储数据的变量,可以有一个,也可以有多个。
options和variables都是可选的,如果没有提供变量名,那么读取的数据将存放到环境变量 REPLY 中。
①options:
- -p:指定读取值时的提示符;
- -t:指定读取值时等待的时间(秒)如果-t 不加表示一直等待
②variables
- 变量:指定读取值的变量名
1.2read的使用



如果超过设置的时间,则直接跳过
边栏推荐
- ACL2021最佳论文出炉,来自字节跳动
- 吃透Chisel语言.24.Chisel时序电路(四)——Chisel内存(Memory)详解
- Case of burr (bulge) notch (depression) detection of circular workpiece
- Interview JD T5, was pressed on the ground friction, who knows what I experienced?
- 电机控制器中的MOS驱动
- Redis 为什么这么快?Redis 的线程模型与 Redis 多线程
- Come on, chengxujun
- 拜托!面试请不要再问我 Ribbon 的架构原理
- Understand chisel language. 27. Chisel advanced finite state machine (I) -- basic finite state machine (Moore machine)
- Review summary of engineering surveying examination
猜你喜欢

Understand chisel language. 27. Chisel advanced finite state machine (I) -- basic finite state machine (Moore machine)

WGAN、WGAN-GP、BigGAN

活体检测综述

After one year, the paper was finally accepted by the international summit

Redis 为什么这么快?Redis 的线程模型与 Redis 多线程

XML概述

A ride into Qinchuan -- a brief talk on how beego Autorouter works

历时一年,论文终于被国际顶会接收了

How to use tdengine sink connector?

习题 --- 快排、归并、浮点数二分
随机推荐
Food safety | are you still eating fermented rice noodles? Be careful these foods are poisonous!
Brush the title "sword finger offer" day04
S交换机堆叠方案配置指南
Understand chisel language. 22. Chisel sequential circuit (II) -- detailed explanation of chisel counter: counter, timer and pulse width modulation
Qt 学习(二) —— Qt Creator简单介绍
QT | about the problem that QT creator cannot open the project and compile it
2016 outlook
wordpress禁止指定用户名登录或注册插件【v1.0】
食品安全 | 菜板环境很重要,这些使用细节你知道吗?
如何在树莓派上安装cpolar内网穿透
Leetcode.1260. 2D grid migration____ In situ violence / dimensionality reduction + direct positioning of circular array
NPM common commands
After one year, the paper was finally accepted by the international summit
WordPress prohibits login or registration of plug-ins with a specified user name [v1.0]
July training (day 20) - binary search tree
swagger-editor
数据分析如何解决商业问题?这里有份超详细攻略
3D人脸重建:Joint 3D Face Reconstruction and Dense Alignment with position Map Regression Network
Review summary of engineering surveying examination
Qt 学习(二) —— .pro文件详解