下面主要用例子说明用法(bash环境下测试)

1.echo显示字符串

普通字符串可以在echo后直接输入字符串,但这样当要输出某些字符如\时会有问题(这种写法的时候\是被当作继行符处理过滤掉的,要输出一个\必须打\\,跟c语言printf输出的要求相象),所以一般最好用´string´ 或"string"的格式,这样即使是\也可以输出,方便直观。

#echo hello world

hello world

#echo hello\ world

hello world

#echo hello\\ world

hello\ world

#echo ´hello\\ world´ 或者: echo "hello\\ world"

hello\\ world

2.echo的转义显示: 加上-e参数

输出多行

#echo -e ´hello\nworld´

hello

world

输出ascii字符: echo -e \NNN (NNN为ascii字符的八进制码号,不符合八进制的将会按照字面意义进行打印)

#echo -e ´\61 \62 \101 \141´

1 2 A a

更详细的可以参看下面的参考资料,enjoy!

参考资料

info echo和man echo得到的信息:

File: coreutils.info, Node: echo invocation, Next: printf invocation, Up: Printing text

`echo´: Print a line of text

============================

`echo´ writes each given STRING to standard output, with a space

between each and a newline after the last one. Synopsis:

echo [OPTION]... [STRING]...

The program accepts the following options. Also see *Note Common

options::.

`-n´

Do not output the trailing newline.

`-e´

Enable interpretation of the following backslash-escaped

characters in each STRING:

`\a´

alert (bell)

`\b´

backspace

`\c´

suppress trailing newline

`\f´

form feed

`\n´

new line

`\r´

carriage return

`\t´

horizontal tab

`\v´

vertical tab

`\\´

backslash

`\NNN´

the character whose ASCII code is NNN (octal); if NNN is not

a valid octal number, it is printed literally.

============================

echo - manual

ECHO(1) FSF ECHO(1)

NAME

echo - display a line of text

SYNOPSIS

echo [OPTION]... [STRING]...

DESCRIPTION

NOTE: your shell may have its own version of echo which will supercede

the version described here. Please refer to your shell´s documentation

for details about the options it supports.

Echo the STRING(s) to standard output.

-n do not output the trailing newline

-e enable interpretation of the backslash-escaped characters listed

below

-E disable interpretation of those sequences in STRINGs

--help display this help and exit

--version

output version information and exit

Without -E, the following sequences are recognized and interpolated:

\NNN the character whose ASCII code is NNN (octal)

\\ backslash

\a alert (BEL)

\b backspace

\c suppress trailing newline

\f form feed

\n new line

\r carriage return

\t horizontal tab

\v vertical tab

AUTHOR

Written by FIXME unknown.

REPORTING BUGS

Report bugs to <>.

COPYRIGHT

Copyright (C) 2002 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is

NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR

PURPOSE.

SEE ALSO

The full documentation for echo is maintained as a Texinfo manual. If

the info and echo programs are properly installed at your site, the

command

info echo

should give you access to the complete manual.

GNU coreutils 4.5.3 February 2003 ECHO(1)

linux下echo的用法,详细讲解:在Linux操作系统中Echo的用法相关推荐

  1. Java实现Linux的md5加密,Linux_详细讲解:Linux系统GRUB的MD5加密方法,1、用grub-md5-crypt成生GRUB的md5密 - phpStudy...

    详细讲解:Linux系统GRUB的MD5加密方法 1.用grub-md5-crypt成生GRUB的md5密码: 通过grub-md5-crypt对GRUB的密码进行加密码运算,比如我们想设置grub的 ...

  2. 如何在linux下用rsync同步文件以及它的用法和scp的用法

    如何在linux下用rsync同步文件以及它的用法和scp的用法 2010年06月06日 root@legend-laptop:/home/legend/httpd~/cgi-bin# rsync - ...

  3. Android webservice的用法详细讲解

    Android webservice的用法详细讲解 看到有很多朋友对WebService还不是很了解,在此就详细的讲讲WebService,争取说得明白吧.此文章采用的项目是我毕业设计的webserv ...

  4. linux系统退出当前计算节点命令,Linux下60个系统命令详细解.doc

    Linux下60个系统命令详细解 嵌入式学习指引--Linux下60个系统命令详细解 Linux为用户提供了大量的命令,利用它可以有效地完成大量的工作,如磁盘操作.文件存取.目录操作.进程管理.文件权 ...

  5. linux下安装DB2的详细步骤

    我也是才学习,在网上找了一个在linux下安装DB2 的步骤,共享给大家看看了. linux下安装DB2的详细步骤! 第一步:检查程序包及其版本 在软件包管理中查看下列软件包是否安装,如没有安装,先安 ...

  6. 【Linux】CentOS7下安装Ngnix代理服务器详细过程 附Linux 64位 Ngnix压缩包百度云盘分享

    [Linux]CentOS7下安装Ngnix代理服务器详细过程 附Linux 64位 Ngnix压缩包百度云盘分享 Ngnix基本概况 Nginx (读作"engine X") 由 ...

  7. Linux下卸载nginx的详细步骤,亲测有效

    1.检查nginx服务是否运行,如果正在运行则关闭服务. ps -ef|grep nginx /usr/local/nginx/sbin/nginx -s stop 2.查找并删除nginx相关文件. ...

  8. linux磁盘限额,LINUX下磁盘限额的详细配置(Centos5.3)

    LINUX下磁盘限额的详细配置 1. 首先,编辑修改/etc/fstab文件: LABEL=/  / ext3 defaults 1 1 改为: LABEL=/  / ext3 defaults,us ...

  9. linux格式化大于2t硬盘分区,linux下大于2tb硬盘格式化及挂载,linux下大于2t的分区方法,linux gpt分区表 管理 自动挂载分区...

    linux下大于2tb硬盘格式化及挂载,linux下大于2t的分区方法,linux gpt分区表 管理 自动挂载分区 (7页) 本资源提供全文预览,点击全文预览即可全文预览,如果喜欢文档就下载吧,查找 ...

  10. Linux下C/C++程序编译链接加载过程中的常见问题及解决方法

    Linux下C/C++程序编译链接加载过程中的常见问题及解决方法 1 头文件包含的问题 报错信息 该错误通常发生在编译时,常见报错信息如下: run.cpp:2:10: fatal error: dl ...

最新文章

  1. linux源码阅读笔记 fork函数
  2. git gui提交无法获知你的身份 20
  3. Swift开发:NSLayoutConstraint纯代码实现自动布局-初级篇
  4. git 大文件报错Out of memory, malloc failed、 The remote end hung up unexpectedly
  5. suse linux 11 HBA信息,HP BL660 GEN8 SUSE 11 查询HBA信息 驱动版本 固件版本 设备名称
  6. Python 最抢手、Java 最流行、Go 最有前途,7000 位程序员揭秘 2019 软件开发现状...
  7. window环境下杀死tomcat
  8. 时间字段加一秒_面试Java后端却问我时间轮(Time Wheel)算法,面试官没想到我看过Dubbo源码!...
  9. AD9361 介绍 (上)
  10. 职业规划范文500字计算机专业,技校计算机专业职业生涯规划500字左右
  11. matlab负反馈传函,已知负反馈系统开环传函求阶跃传函
  12. Linux基础:systemctl和journalctl常用命令
  13. 阿里easyExcel学习笔记(maven)
  14. 分析项目-AQI分析与预测
  15. Win 10关机后电源灯不停闪烁的解决办法
  16. angular1的分页
  17. (附源码)spring boot大学生综合素质测评系统 毕业设计162308
  18. 远程桌面连接的工具及使用方法
  19. Win10如何自定义右键菜单-修改注册表(图文)
  20. Springboot 整合Retry 实现重试机制

热门文章

  1. 12.第五章 参数假设检验(1)
  2. 如何防范p2p终结者的限速
  3. Linux查看文件MD5校验码命令,讲解Linux中校验文件的MD5码与SHA1码的命令使用
  4. 【十八】深拷贝与浅拷贝
  5. TCP连接中seq和ack是什么东西呢
  6. 海天酱油开展品质革命,让中国美味走出国门
  7. [TI TDA4 J721E]PROCESSOR-SDK-J721E Demo开发板运行与测试 基于 ubuntu 18.04
  8. 这辈子碰到的最大人生遗憾之一---买了一个洗碗机!
  9. 解决sublime text 3中color highlight和color highlighter插件无法正常运行的问题
  10. 使用hexo搭建自己的博客系统