Hi Tim,

Bob wrote:
> Tim wrote:
> > find /var/log/ -name "*.log" -type f -mtime +7 -delete

Start with -print instead of -delete so if you have a bug you don't
delete the wrong files.

Also, use '' instead of "" in general as the shell interprets less
within them, i.e. the contents are more literal.  Both will work in the
above case, but it's a habit to form: Use '', drop back to "" when
needed.

> But if you insist try adding the "shebang" header to the start of your
> script.
>   #!/bin/sh

Then show up precisely what's in the file...

    pr -tnv deletefile.sh

> Also you did remember to "chmod +x deletefile.sh" ?

...and information about the file:

    ls -l deletefile.sh

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2025-05-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  https://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to