Ah!  The dreaded newline/carriage return bug!

We had a dba who had written a script that used to work but suddenly
wouldn't.  I cut it down line by line until the only thing left was
"#!/bin/sh".  It still wouldn't work.  I then bonked the dba on the head
several times.

-----Original Message-----
From: Fargusson.Alan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 24, 2005 12:17 PM
To: LINUX-390@VM.MARIST.EDU
Subject: Re: Guidance on script writing

I was able to reproduce your result by adding a carriage return to the end
of the find command.  This makes me think that either you saved the shell
script in dos format, or you have some junk after the semicolon.

-----Original Message-----
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of
Longstreth, Lance
Sent: Tuesday, May 24, 2005 9:59 AM
To: LINUX-390@VM.MARIST.EDU
Subject: Guidance on script writing


Taking the advice of Alan Fargusson and Chris Little, I added a backslash to
the end of the path and took the quotes out from around the brackets. I also
tried these independent of each other. But, I still receive the same message
of "Usage: find [path...] [expression]". As seen below


Messages from console:

[EMAIL PROTECTED]:~> sh -x del.sh
+ find /var/log/ -mtime +7 -type f -exec rm '{}' ';' $'\r'
find: paths must precede expression
Usage: find [path...] [expression]

Changed script:

########################################################################
#     deletelg.sh -- Script to delete logs files                       #
#     changed to only keep +7                                          #
########################################################################
find /var/log/ -mtime +7 -type f -exec rm {} \;


Orginal script

########################################################################
# deletelg.sh -- Script to delete logs files # # changed to only keep +7 #
########################################################################
find /var/log -mtime +7 -type f -exec rm ``{}'' \;

Lance Longstreth
Bandag Inc
Technical Support & Operations
zOS systems/Linux
1-(563)-262-2927
[EMAIL PROTECTED]




----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions, send email
to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions, send email
to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to