我没有给出cat filename.txt,而是给出了cat >filename.txt。我在filename.txt中的全部内容都被删除了。我可以取回内容吗?它将存储在哪里? 如果有人知道,请帮我找回内容..
最佳答案
我对您的(数据)丢失表示同情。
防止将来发生这种情况的一种方法是使用“noclobber”shell 设置:
$ touch veryImportantFile
$ cat >veryImportantFile
uh oh
$ cat veryImportantFile
uh oh
$ set -o noclobber
$ cat >veryImportantFile
bash: veryImportantFile: cannot overwrite existing file
$ echo "I really want to overwrite" >| veryImportantFile
$ cat veryImportantFile
I really want to overwrite
请注意使用 >|
重定向器来强制覆盖。
关于linux - 如果我在unix中输入cat>filename.txt,是否可以检索数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36040433/