鍍金池/ 問答/Linux/ crontab -e 下輸入任務(wù)怎么保存不了,好像不是vi編輯器模式下啊

crontab -e 下輸入任務(wù)怎么保存不了,好像不是vi編輯器模式下啊

圖片描述

好像不是vi編輯器模式,如何切過去呢,現(xiàn)在Esc+wq都不管用

回答
編輯回答
扯不斷

你說不是就不是嘍

The -e option is used to edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables. After you exit from the editor, the modified crontab will be installed automatically. If neither of the environment variables is defined, then the default editor /usr/bin/editor is used.

在我的機器上的結(jié)果是

$ ls -al /usr/bin/editor

lrwxrwxrwx 1 root root 24 11月 25  2014 /usr/bin/editor -> /etc/alternatives/editor

$ ls -al /etc/alternatives/editor

lrwxrwxrwx 1 root root 16 1月  21  2016 /etc/alternatives/editor -> /usr/bin/emacs24

所以我機器上用的是emacs, 看看你的機器上是什么就知道了.


用`$ sudo update-alternatives --list editor` 查看本機器究竟有哪些editors,
/bin/ed
/bin/nano
/usr/bin/emacs24
/usr/bin/mcedit
/usr/bin/vim.basic
/usr/bin/vim.tiny

然后用sudo update-alternatives --set editor設(shè)置成你喜歡的.

2018年6月5日 05:10
編輯回答
枕邊人

看一下你是不是搞了輸入法,ESC不排除鍵盤問題,多按幾次,左下角會有提示的。如果不是INSERT證明進入命令模式了,按:wq

2018年9月4日 03:26