[95159] in RedHat Linux List

home help back first fref pref prev next nref lref last post

Re: Question about scripts

daemon@ATHENA.MIT.EDU (John H Darrah)
Thu Oct 15 15:44:39 1998

Date: Thu, 15 Oct 1998 12:44:21 -0700 (PDT)
From: John H Darrah <jhd@giddens.com>
To: Redhat ML <redhat-list@redhat.com>
In-Reply-To: <Pine.BSI.4.05L.9810151423210.17065-100000@www.inetnow.net>
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

On Thu, 15 Oct 1998 zappa@inetnow.net wrote:

> Hi all,
> I wrote a bash script to run as a cron job which removes those pesky files
> emacs leaves behind. Here is my script:
> #!/bin/bash
> 
> PATH=/bin:/usr/bin
> 
> find / \( -name a.out -o -name core -o -name '*~' \
>  -o -name '.*~' -o -name '#*#' \) -type f -atime +10 \
>  -exec rm { } \; -o -fstype nfs -prune -o -path /mnt/win95c -prune \
>  -o -path /mnt/win95d -prune -o -path /mnt/win95e -prune
> 
> exit 0
> 
> If I run this find command at a bash shell prompt everything works fine
> but if I place it in a script I get errors about can't find whatever file.
> If I replace -exec with -ok rm prompts me to remove the correct files but I
> still get an error after it tries to remove each file. Any ideas?

You have a space between the { and } brackets.
Remove the space and it will work fine.

This:
   -exec rm { } \;

Should be like this

   -exec rm {} \;

--
John Darrah (u05192)	| Dept: N/C Programming
Giddens Industries	| Ph: (425) 353-0405 #229
PO box 3190		| Ph: (206) 767-4212 #229
Everett  WA    98203	| Fx: (206) 764-9639


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
		http://www.redhat.com http://archive.redhat.com
         To unsubscribe: mail redhat-list-request@redhat.com with 
                       "unsubscribe" as the Subject.


home help back first fref pref prev next nref lref last post