From owner-freebsd-questions Wed Nov 1 23:59:22 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mailhost01.reflexnet.net (mailhost01.reflexnet.net [64.6.192.82]) by hub.freebsd.org (Postfix) with ESMTP id E47E637B7F1 for ; Wed, 1 Nov 2000 23:47:33 -0800 (PST) Received: from 149.211.6.64.reflexcom.com ([64.6.211.149]) by mailhost01.reflexnet.net with Microsoft SMTPSVC(5.5.1877.197.19); Wed, 1 Nov 2000 23:46:11 -0800 Received: (from cjc@localhost) by 149.211.6.64.reflexcom.com (8.11.0/8.11.0) id eA27lK323256; Wed, 1 Nov 2000 23:47:20 -0800 (PST) (envelope-from cjc) Date: Wed, 1 Nov 2000 23:47:20 -0800 From: "Crist J . Clark" To: Steve Price Cc: freebsd-questions@FreeBSD.ORG Subject: Re: 'crontab -e' woes Message-ID: <20001101234720.J75251@149.211.6.64.reflexcom.com> Reply-To: cjclark@alum.mit.edu References: <20001101210426.A57642@bsd.planetwe.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20001101210426.A57642@bsd.planetwe.com>; from sprice@hiwaay.net on Wed, Nov 01, 2000 at 09:04:26PM -0600 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Nov 01, 2000 at 09:04:26PM -0600, Steve Price wrote: > Howdy all, > > Don't know if it is just a couple of days of absolutely no > sleep or what but I've been scratching my over head what > should be a simple problem. > > Basically what I'm trying to do is setup a non-interactive > script that edits my crontab. When I type the following > commands in it comments out the first entry. However, when > I run it by redirecting stdin from a file it doesn't work. > >From the looks of it (note the 37 -> 38 change) the file > is being updated but crontab is ignoring the change. > > steve@bsd(/tmp)$ crontab -l > # DO NOT EDIT THIS FILE - edit the master and reinstall. > # (/tmp/crontab.teFMi62568 installed on Wed Nov 1 20:47:27 2000) > # (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v 1.12 1999/08/28 01:15:52 peter Exp $) > */1 * * * * /home/steve/bin/bogus.sh > steve@bsd(/tmp)$ cat cmds > 1s/^/#/ > wq > steve@bsd(/tmp)$ env VISUAL=/bin/ed crontab -e < cmds > 37 > 38 > crontab: no changes made to crontab > steve@bsd(/tmp)$ cat cmds | env VISUAL=/bin/ed crontab -e > 37 > 38 > crontab: no changes made to crontab > steve@bsd(/tmp)$ > > Can anyone tell what I'm doing wrong? Thanks. Don't ask me why, but try this, $ { echo '1s/^/#/'; echo w; } | env VISUAL=/bin/ed crontab -e And see what happens. (Just lost the 'q.') -- Crist J. Clark cjclark@alum.mit.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message