shell中的echo和read

简介:

Eg:

 

 
  1. #!/bin/bash 
  2.  
  3. #echo 
  4.  
  5. echo –e “This echo’s 3 new lines \n\n\n” 
  6.  
  7. echo “ok” 
  8.  
  9. echo 
  10.  
  11. echo “This echo’s 3 new lines\n\n\n” 
  12.  
  13. echo “The log files have all been done”>mylogfile.txt 

 

Eg:

 
  1. #!/bin/bash 
  2. #readmname 
  3. echo -n "First Name:" 
  4. read firstname 
  5. echo -n "Last Name:" 
  6. read lastname subname 
  7. echo -e "your First Name is :$firstname\n" 
  8. echo -e "your Last Name is :$lastname\n" 
  9. echo -e "your Subname is:$subname\n" 

本文转自sucre03 51CTO博客,原文链接:http://blog.51cto.com/sucre/424913,如需转载请自行联系原作者

相关文章
|
4月前
|
人工智能 机器人 Shell
【shell】文件读写及read用法
【shell】文件读写及read用法
|
4月前
|
存储 Shell Linux
【Shell 命令集合 文件管理】Linux 读取命令 read命令使用指南
【Shell 命令集合 文件管理】Linux 读取命令 read命令使用指南
81 0
|
2月前
|
Shell Linux
Linux环境变量之shell中export定义全局变量和echo 变量的区别
Linux环境变量之shell中export定义全局变量和echo 变量的区别
|
4月前
|
存储 Shell 数据安全/隐私保护
【Shell 编程指南】Shell read命令 (从标准输入读取数值)
【Shell 编程指南】Shell read命令 (从标准输入读取数值)
195 0
|
Shell Linux Perl
Shell基础学习---3、Read读取控制台输入、函数、正则表达式入门
Shell基础学习---3、Read读取控制台输入、函数、正则表达式入门
|
4月前
|
Shell Linux Perl
Shell基础学习---3、Read读取控制台输入、函数、综合应用案例:归档文件、正则表达式入门(第二天学习)
Shell基础学习---3、Read读取控制台输入、函数、综合应用案例:归档文件、正则表达式入门
103 1
|
9月前
|
Shell PHP
Shell echo命令
Shell echo命令
56 0
|
Shell 数据处理 Perl
Shell编程中的echo命令详解及应用技巧
Shell编程中的echo命令详解及应用技巧
310 0
|
前端开发 Shell
Shell echo 详细介绍(-n、-e、-e字体颜色背景以及其他配置项)
Shell echo 详细介绍(-n、-e、-e字体颜色背景以及其他配置项)
194 0
|
存储 Shell
Shell read 键盘输入并复制给变量
Shell read 键盘输入并复制给变量
88 0