Problem with cron

Michael Schwendt mschwendt at gmail.com
Wed Apr 17 09:57:06 UTC 2013


On Sun, 24 Mar 2013 10:02:31 -0700, Joe Zeff wrote:

> On 03/24/2013 03:12 AM, Michael Schwendt wrote:
> > Verify that $EDITOR is set actually. $EDITOR is evaluated here just fine.
> > And
> >
> >    $ echo $EDITOR
> >    emacs
> >    $ EDITOR=nano crontab -e
> >    <Ctrl-X>
> >    crontab: no changes made to crontab
> 
> As I'm sure I've written before, I've checked this with echo, and 
> they're set.  However, do they need to be Exported to be picked up by 
> crontab?

I'm not sure I understand the question, because above example already
shows how the $EDITOR environment variable is set to nano for crontab
to pick it up.

The example could be rewritten to be more clear:

  $ echo $EDITOR
  emacs
  $ EDITOR=nano
  $ echo $EDITOR
  nano
  $ crontab -e
  <Ctrl-X>
  crontab: no changes made to crontab

The "Ctrl-X" refers to exiting "nano". One can see that $EDITOR is set
correctly in the environment and that "crontab" picks it up.

Exporting refers to whether parts of the environment (here a variable)
would be automatically made available to subsequent commands (which
can be especially important for running shell-scripts).

  $ TEST=hello
  $ echo $TEST
  hello
  $ bash
  $ echo $TEST

  $ exit
  $ export TEST
  $ bash
  $ echo $TEST
  hello
  $ exit
  $

-- 
Fedora release 19 (Schrödinger’s Cat) - Linux 3.9.0-0.rc6.git2.1.fc19.x86_64
loadavg: 0.14 0.13 0.14


More information about the users mailing list