LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-12-2014, 09:27 AM   #1
SmurfGGM
Member
 
Registered: Jul 2008
Posts: 49

Rep: Reputation: 0
Find error doing my head in !


Hi there,

Hopefully someone can help with this which his really doing my head in.

I have in a script ..

Code:
while read line
  do
    find $XHOME -type f -name $line | grep -v fixes > files.tmp
  done < files_list.tmp
When I run it from a script, I get this error ..

find: missing argument to `-name'

When I run the find command on its own outside of the script, it works fine.

Any idea's ?

Many thanks

Last edited by SmurfGGM; 06-12-2014 at 10:14 AM.
 
Old 06-12-2014, 10:06 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748
Perhaps you need to specify the full path to files_list.tmp?

BTW- When posting code please include between [CODE][/CODE] tags.

Last edited by allend; 06-12-2014 at 10:07 AM.
 
Old 06-12-2014, 10:15 AM   #3
SmurfGGM
Member
 
Registered: Jul 2008
Posts: 49

Original Poster
Rep: Reputation: 0
nope, that didn't fix it

(CODE fixed)

thanks
 
Old 06-12-2014, 10:34 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
can you please run it like so so we can get a display of what is going on:
Code:
echo XHOME = $XHOME
while read line
  do
echo line = $line
    find $XHOME -type f -name $line | grep -v fixes > files.tmp
  done < files_list.tmp
(others will suggest adding #!/bin/bash -x to the first line of the script for debugging purposes)

Last edited by schneidz; 06-12-2014 at 10:46 AM.
 
Old 06-12-2014, 10:39 AM   #5
SmurfGGM
Member
 
Registered: Jul 2008
Posts: 49

Original Poster
Rep: Reputation: 0
The $line & $CFXHOME are being picked up fine.

It just doesnt seem to line the -name from within the while loop


+ echo /home/test/gp/efin
/home/test/gp/efin
+ read line
+ echo line = acts035.fmt
line = acts035.fmt
+ find /home/test/gp/efin -type f -name acts035.fmt
+ grep -v fixes
+ read line
+ echo line = cfacs.mcs
line = cfacs.mcs
+ find /home/test/gp/efin -type f -name cfacs.mcs
+ grep -v fixes
+ read line
+ echo line = cfxdkerf.sqd
line = cfxdkerf.sqd
+ find /home/test/gp/efin -type f -name cfxdkerf.sqd
+ grep -v fixes
+ read line
+ echo line = mandate.sqd
line = mandate.sqd
+ find /home/test/gp/efin -type f -name mandate.sqd
+ grep -v fixes
+ read line
+ echo line = pops005.fmt
line = pops005.fmt
+ find /home/test/gp/efin -type f -name pops005.fmt
+ grep -v fixes
+ read line
+ echo line = reqs001.fmt
line = reqs001.fmt
+ find /home/test/gp/efin -type f -name reqs001.fmt
+ grep -v fixes
+ read line
+ echo line = reqs025.fmt
line = reqs025.fmt
+ find /home/test/gp/efin -type f -name reqs025.fmt
+ grep -v fixes
+ read line
+ echo line = s_postcode.sqd
line = s_postcode.sqd

+ find /home/test/gp/efin -type f -name s_postcode.sqd
+ grep -v fixes
+ read line
+ echo line = wndskdob.sqn
line = wndskdob.sqn
+ find /home/test/gp/efin -type f -name wndskdob.sqn
+ grep -v fixes
+ read line
+ echo line =
line =
+ find /home/test/gp/efin -type f -name
+ grep -v fixes
find: missing argument to `-name'
+ read line
++ date +%Y-%m-%d
+ DATE=2014-06-12
 
Old 06-12-2014, 10:41 AM   #6
SmurfGGM
Member
 
Registered: Jul 2008
Posts: 49

Original Poster
Rep: Reputation: 0
ahh, i've fixed it.

I had a blank line at the bottom of my input file.

Thanks for reading
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Head to Head Desktop Comparison: Ubuntu 12.10 vs OS X Mountain Lion LXer Syndicated Linux News 0 01-24-2013 03:40 AM
How to find the package name of a head file(xxx.h) TriggerHuang Linux - Software 1 12-30-2011 03:16 AM
[SOLVED] where can I find the head files? mei0fei Linux - Kernel 2 08-22-2011 12:30 AM
In over my head on these error messages oldog Linux - General 4 07-24-2008 06:21 PM
how to find the head file where a Constant was defined greghua Programming 1 08-12-2005 03:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration