The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
crontab + exec command naushad Shell Programming and Scripting 4 03-27-2008 12:23 AM
Help with exec command and file descriptors?? rfourn Shell Programming and Scripting 1 07-18-2007 03:05 PM
find command exec error pavan_test UNIX for Dummies Questions & Answers 2 06-13-2006 12:58 AM
exec command g_s_r_c Shell Programming and Scripting 1 09-20-2004 09:20 AM
using the -exec command moxxx68 UNIX for Dummies Questions & Answers 0 04-13-2004 11:51 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 09-05-2008
Registered User
 

Join Date: Jul 2007
Posts: 107
Quote:
Originally Posted by era View Post
You need a space after the opening parenthesis. It's not clear why you were getting the error message in the first place but maybe just retyping a different command coincidentally fixes whatever was wrong (missing characters? Random invisible characters?)


I took your advice and retyped. Still getting the same error. If I type the command it works. If I run it from the ksh script I get the error:

find: missing argument to `-exec'
Reply With Quote
Forum Sponsor
  #9  
Old 09-06-2008
Registered User
 

Join Date: Jul 2007
Posts: 107
Hello,

I really still need some help in getting this script to work.

If I type out the command it works. If I put the exact same command in a .ksh script, I get the error:

Find: missing argument to `-exec`.

Why would it do this in the script and not at the command line?
Reply With Quote
  #10  
Old 09-07-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
First question:
Does the first line of the script look like this?

Code:
#!/bin/ksh
Next question:
does the output of this show any weird characters on the problem line
Code:
od -c myscript.sh
Finally - cut and paste (do not retype) the whole line that is a problem so we can read it. Include full command line above it and below it. Please give us the OS and shell -- ksh88 or ksh93.
Reply With Quote
  #11  
Old 09-07-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Or a workaround
Code:
find /dir1/dir2 -type f -name "FILE.*" -newer /dir1/dir2/afterme.txt | \
while read filename 
do
    cp $filename /dir1/dir2/dir3/
done
Reply With Quote
  #12  
Old 09-07-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
I'm with Jim on this. The .ksh extension does not at all effect which shell will be invoked. If it's a sh with a different PATH than you run interactively, you could be getting another version of find than you get at the command line. Another thing to watch out for is DOS carriage returns in the script. You're not writing it on a Windoze machine and uploading it to your Unix account, are you?
Reply With Quote
  #13  
Old 09-08-2008
Registered User
 

Join Date: Jul 2007
Posts: 107
No, I used vi to create the file. I had the #!/bin/ksh at the top of the line but I was getting this error:

: bad interpreter: No such file or directory
Reply With Quote
  #14  
Old 09-08-2008
Registered User
 

Join Date: Jul 2007
Posts: 107
Quote:
Originally Posted by jim mcnamara View Post
Or a workaround
Code:
find /dir1/dir2 -type f -name "FILE.*" -newer /dir1/dir2/afterme.txt | \
while read filename 
do
    cp $filename /dir1/dir2/dir3/
done

Here is the error I get when I run the above from the script:

: command not founde 1:
./scriptname.ksh: line 7: syntax error: unexpected end of file

I just don't get it. From the command line it works. From ./scriptname.ksh ERROR!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0