gpt4 book ai didi

file - 防止 nano 在收到 SIGHUP 或 SIGTERM 时创建保存文件

转载 作者:行者123 更新时间:2023-12-04 03:09:28 24 4
gpt4 key购买 nike

你好

文本编辑器nano has this feature ,当编辑器收到 SIGHUP 或 SIGTERM 或内存不足时创建一个保存文件。

在这种情况下,nano 将当前编辑器内容写入名为 nano.save 的临时文件,或者,如果编辑现有文件,nano 会将 .save 后缀添加到这个文件名:filename.save

基本上这是一个很棒的功能。 问题 是,我正在使用 nano 编辑 /etc/cron.d/ 中的文件,因此在此文件夹中找到很多 *.save 文件。

所以这最终会导致双重 cron 作业。

所以我的问题是:

  1. 有没有办法阻止 nano 将这些缓冲区保存到文件系统?

  2. 或者是否可以将这些文件的文件夹更改为另一个固定位置?

  3. 或者有其他方法告诉 cron 不要运行包含/.save/的文件

提前致谢

最佳答案

根据手册页:https://www.nano-editor.org/dist/v2.2/nano.1.html

−R (−−restricted) Restricted mode: don’t read or write to any file not specified on the command line; read any nanorc files; allow suspending; allow a file to be appended to, prepended to, or saved under a different name if it already has one; or use backup files or spell checking. Also accessible by invoking nano with any name beginning with ’r’ (e.g. "rnano").

因此,一种解决方案是简单地使用“rnano”或“nano -R”。

关于file - 防止 nano 在收到 SIGHUP 或 SIGTERM 时创建保存文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46429092/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com