什么输出将回显>生产? [英] What output will echo > produce?

查看:78
本文介绍了什么输出将回显>生产?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我手头没有Linux,而是使用compileonline.com在bash中签出一些代码,但是我对bash还是陌生的.有人可以帮忙吗?

I don't have a linux at hand and instead use compileonline.com to check out some code in bash, yet I'm new to bash. Could somebody give a hand?

for var
do echo $var > fniz
  cat fniz
done

参数为123 abc xyz

arguments are 123 abc xyz

我的猜测是,输出将是:

My guess is, the output would be:

123
123
abc
123
abc
xyz

但是我不确定echo $ var> fniz是覆盖fniz还是向其中写入新行.它会覆盖文件吗?

But I'm not sure, whether echo $var > fniz overwrites fniz or writes a new line to it. Does it overwrite the file?

推荐答案

>始终会覆盖.

使用追加"重定向运算符>>可以写新行.

Writing a new line would be achieved by using the "append" redirection operator >>.

这篇关于什么输出将回显>生产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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