I am trying to work with crontabs, and cron never asked me which text editor I would like to use, and I don't like the choice it has taken.
To my surprise, when I run echo $EDITOR
, I get a blank output.
I can change it with export EDITOR=/usr/bin/nano
, so it is set for the session, but as soon as I log-out it doesn't retain the value.
I want it to be the system-wide default, so I can use it with all users, but adding EDITOR=/usr/bin/nano
, which is the location of nano, to my /etc/environment, killing the terminal and relaunching still returns a blank line when running echo $EDITOR
.
As @CHAOTING says down below, adding export EDITOR=/usr/bin/nano
to the .zshrc file in my home folder helped. Now, it is the default environmental variable for my user and for root, but running commands with sudo, I still get the wrong editor. Is there anyway the variable can be made trully global?
It's really a workflow problem. Now, I just use the editor of choice to open the crontab from its full path.
micro /var/spool/cron/foo
After running into this issue multiple times, the best workflow to circumvent the actual problem is just using my text editor of choice and opening the crontabs' full path:
micro /var/spool/cron/foo