LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 08-31-2007, 02:57 AM   #1
lowlifeish
Member
 
Registered: Oct 2002
Location: San Francisco, CA
Distribution: redhat
Posts: 50

Rep: Reputation: 16
Error running command via shell script


Hi there,

Consider the following command:

find "/cygdrive/c/Documents and Settings/lowlife/Desktop/" -wholename '/cygdrive/c/Documents and Settings/lowlife/Desktop/asdf' -prune -o -print

When I run that from the command line I get no error. However, when I run it from a shell script I get this error:

find: unknown predicate `-wholename '/cygdrive/c/Documents and Settings/lowlife/Desktop/asdf' -prune -o'

My script look like this:

for j in `find "$entry" $exclude -print`; do

where entry="/cygdrive/c/Documents and Settings/lowlife/Desktop"
and exclude="-wholename '/cygdrive/c/Documents and Settings/lowlife/Desktop/asdf' -prune -o"

Does anyone know what I'm missing?

- L
 
Old 08-31-2007, 03:19 AM   #2
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
I don't think I have the answer, but the last part doesn't look right. Where you have "do", should it not be "done"?
 
Old 08-31-2007, 10:38 PM   #3
lowlifeish
Member
 
Registered: Oct 2002
Location: San Francisco, CA
Distribution: redhat
Posts: 50

Original Poster
Rep: Reputation: 16
No, consider the following script.

Quote:
#!/bin/bash

entry="/cygdrive/c/Documents and Settings/asdfjkl/Desktop"
exclude="-wholename '/cygdrive/c/Documents and Settings/asdfjkl/Desktop/asdf' -prune -o"

#find "/cygdrive/c/Documents and Settings/asdfjkl/Desktop/" -wholename '/cygdrive/c/Documents and Settings/asdfjkl/Desktop/asdf' -prune -o -print

echo "find \"$entry\" $exclude -print"
for j in `find "$entry" $exclude -print`; do
echo "$j"
done
Looking at the previous comment it looks like I posted the settings incorrectly.

If you test out the test script above (setting up your own directories) you'll find that if you run the command output from echo the find command will work.

However, if you run the script it does not work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
running shell script: command not found tripat Red Hat 3 04-14-2010 01:21 PM
error in running the shell script bhandu Linux - Newbie 1 07-10-2007 01:16 AM
Can't seem to run a simple shell script error command not found each time SimonT Linux - Newbie 5 10-29-2006 06:31 AM
running a command with args from a shell script KM3 Programming 3 10-19-2006 01:46 PM
Running a shell script remotely via 'ssh <hostname> <command>' davee Linux - General 4 10-09-2005 01:38 AM


All times are GMT -5. The time now is 04:24 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration