可以使用linux cat命令将文本写入文件吗? [英] Can linux cat command be used for writing text to file?

查看:1449
本文介绍了可以使用linux cat命令将文本写入文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是这样的:

cat "Some text here." > myfile.txt

可能吗?这样,myfile.txt的内容现在将被覆盖为:

Possible? Such that the contents of myfile.txt would now be overwritten to:

Some text here.

这对我不起作用,但也不会引发任何错误.

This doesn't work for me, but also doesn't throw any errors.

对基于cat的解决方案特别感兴趣(不是vim/vi/emacs等).在线上的所有示例都显示cat与文件输入一起使用,而不是原始文本...

Specifically interested in a cat-based solution (not vim/vi/emacs, etc.). All examples online show cat used in conjunction with file inputs, not raw text...

推荐答案

这就是echo的作用:

echo "Some text here." > myfile.txt

这篇关于可以使用linux cat命令将文本写入文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆