0

I want to add a crontab entry.
When I run the command

crontab -e

I just get a number as output! How to fix this issue?

https://i.stack.imgur.com/v1RId.jpg

  • Hello and welcome to Ask Ubuntu! Can you edit your question and post the output of crontab -l? – Mr Shunz Sep 25 '18 at 12:18
  • HI, crontab -l lists the contents of crontab correctly. only the crontab -e command was not working.. i followed the steps outlined by Rovo and selected the editor.. Now its working fine.. – Ravi Kumar CH Sep 26 '18 at 9:12
2

crontab gets opened with the default editor, which is saved in the EDITOR environment variable.

for me, this is vim:

$ echo $EDITOR
vim

You can run crontab overriding the default editor like this:

EDITOR=editor-of-your-choice crontab -e

to permanently select a default editor, you can simply run this and choose the right number:

select-editor

then, crontab -e should now open with your editor of choice.

See this related question: Changing default crontab editor

  • In particular, the number followed by an apparently empty prompt is the behavior expected when EDITOR=ed (969 being the number of lines in the file) – steeldriver Sep 25 '18 at 17:16
  • select-editor command did the trick.. thank you verymuch. – Ravi Kumar CH Sep 26 '18 at 9:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.