看啥推荐读物
专栏名称: Linux学习
专注分享Linux/Unix相关内容,包括Linux命令、Linux内核、Linux系统开发、Linux运维、网络编程、开发工具等Linux相关知识和技术
今天看啥  ›  专栏  ›  Linux学习

Linux read的用法

Linux学习  · 公众号  · linux  · 2019-01-15 12:18
作者:子非木链接:https://www.cnblogs.com/wangtao1993/p/6136169.html1、read基本读取  1 #!/bin/bash  2 #testing the read command  3   4 echo -n "Enter you name:"   #echo -n 让用户直接在后面输入   5 read name  #输入的多个文本将保存在一个变量中  6 echo "Hello $name, welcome to my program."                                      执行:# ./read.shEnter you name: wangtaoHello wangtao, welcome to my program.2、read -p (直接在read命令行指定提示符)  1 #!/bin/bash  2 #testing the read -p option  3 read -p "Please enter your age: " age  4 days=$[ $age * 365 ]  5 echo "That makes you over $days days old!"执行:# ./age.shPlease enter your age: 23That makes you over 8395 days old!3、read -p (指定 ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照