delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/21/00:52:12

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Mon, 21 Apr 2003 00:51:47 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Ehud Karni <ehud AT unix DOT mvs DOT co DOT il>
cc: cygwin AT cygwin DOT com, <lucianoav AT gmx DOT net>
Subject: Re: Using $EDITOR (Was Re: [ANNOUNCEMENT] Updated: cron-3.0.1-9)
In-Reply-To: <200304201328.h3KDSNQP020459@beta.mvs.co.il>
Message-ID: <Pine.GSO.4.44.0304210048270.19398-100000@slinky.cs.nyu.edu>
Importance: Normal
MIME-Version: 1.0

On Sun, 20 Apr 2003, Ehud Karni wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, 16 Apr 2003 21:37:28 -0400 (EDT), Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu> wrote:
> >
> > Yes, you can do that.  That way programs like crontab will invoke your
> > editor when they need to edit a file.  However, be aware that such
> > programs often expect certain behavior, for example, that the inode of the
> > file doesn't change when it's edited (i.e., the file is written in place).
>
> This can be easily done with a script (use its name for $EDITOR):
>
> #!/bin/sh
> cp $1 /temp/crontab/name           # copy to a temp file
> <YOUR_EDITOR> /temp/crontab/name   # edit it (e.g. with emacs)
> cat /temp/crontab/name > $1        # save as original file (and inode)
>
> Ehud.

Ehud,

Actually, you might want to use "cp -p", just in case the editor checks
timestamps, but otherwise, good point.  You might also have to clean up if
the editor renames the original file to *.bak or something, but this is
editor-specific.  You also will need the "ash" package installed for this
(trivial, but thought I'd mention it for the archives anyway).
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Knowledge is an unending adventure at the edge of uncertainty.
  -- Leto II


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019