0
点赞
收藏
分享

微信扫一扫

BashBites:How to Append Outputs to a File

非常帅气的昵称吧 2022-09-06 阅读 98


Is there any way to append output(debugging information) to a existings file? As we all know in bash the command ‘>’ will write ouputs to a file.However this command will also erase the existing data it the file.
Of course bash provides a command that appends outputs to a file.It resembles ‘>’.It’s ‘>>’
The following is a piece of example code.

Let’s look at >



1
2
3
4
5
6
7
8

[[email protected] tmp]$ touch a.txt
[[email protected] tmp]$ cat a.txt
[[email protected] tmp]$ echo "ABC"[[email protected] tmp]$ cat a.txt
ABC
[[email protected] tmp]$ echo "DEF"[[email protected] tmp]$ cat a.txt
DEF

Well,Let’s look at the exiciting command >>



1
2
3
4

[[email protected] tmp]$ echo "GHI"[[email protected] tmp]$ cat a.txt
DEF
GHI

举报

相关推荐

0 条评论