echo重定向文件 linux
2015-01-04 21:04:48 tengdazhang770960436 阅读数 647

覆盖: echo aa > a.txt

追加: echo aa >> a.txt

注意: > 和 >>  的前面要有空格,后面的空格可有可无

2018-05-09 21:59:32 qq_41122796 阅读数 2429

1.echo 文字内容

echo会在终端中显示指定的文字,通常会和重定向联合使用

也可以创建文本文件



2.重定向 > 和 >>

Linux允许将命令执行结果重定向到一个文件

将本应显示在终端上的内容输出/追加指定文件

其中

>表示输出,会覆盖文件原有的内容

>>表示追加,会将内容追加到已有的文件的末尾。


当命令的输出太多的时候,就可以用重定向把系统输出存在文件里,如;

tree >> test.txt 把树形图输出在test.txt文件里

more test.txt 以分屏的方式读





2017-09-01 19:14:51 superdangbo 阅读数 4687


用echo命令,将空字符串内容重定向到指定文件中:


  1. #echo""> access.log
  2. 或者
  3. #echo> access.log


2009-04-09 21:01:00 Laphy 阅读数 692

将标准输出重定向到文件要注意以下三个概念:

标准输入、标准输出以及错误输出分别对应于文件描述符0、1、2.

内核总是使用最低可用文件描述符。

文件描述符集合通过exec调用传递,且不会改变。

2009-02-20 12:14:00 iteye_8623 阅读数 60

Linux - echo

ECHO(1) User Commands ECHO(1)



NAME
echo - display a line of text

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

DESCRIPTION
Echo the STRING(s) to standard output.

-n do not output the trailing newline

-e enable interpretation of backslash escapes

-E disable interpretation of backslash escapes (default)

--help display this help and exit

--version
output version information and exit

If -e is in effect, the following sequences are recognized:

/0NNN 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

NOTE: your shell may have its own version of echo, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports.

AUTHOR
Written by FIXME unknown.

REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.

COPYRIGHT
Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

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 6.9.92.4-f088d-dirtJanuary 2008 ECHO(1)

[Linux- 相关问题]

col
echo
test

linux echo

阅读数 437

linux echo

阅读数 236

linux echo

阅读数 1123

Linux - echo

阅读数 939

linux echo

阅读数 242

没有更多推荐了,返回首页