man crontab reads:
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 auto‐
matically. If neither of the environment variables is defined, then the default editor /usr/bin/edi‐
tor is used.
I see that
echo $VISUAL $EDITOR $SENSIBLE_EDITOR $SELECTED_EDITOR
gives an empty line, so I thought it must be /usr/bin/editor that crontab will determine the path to the editor binary from.
$ file /usr/bin/editor
/usr/bin/editor: symbolic link to /etc/alternatives/editor
$ file /etc/alternatives/editor
/etc/alternatives/editor: symbolic link to /bin/nano
$ file /bin/nano
/bin/nano: ELF 64-bit LSB shared object (...)
So I thought crontab would use nano. However, when I do crontab -e, there is Vim run. Why?
My environment
crontab:
$ apt show "$(dpkg -S "$(which crontab)" | cut -d: -f1)"
Package: cron
Version: 3.0pl1-136ubuntu1
(...)
sensible-editor:
$ apt show "$(dpkg -S "$(which sensible-editor)" | cut -d: -f1)"
Package: sensible-utils
Version: 0.0.12+nmu1
(...)
PS.: sensible-editor runs Vim, and:
$ cat ~/.selected_editor
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/vim.basic"