The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
list tunable parameters and its values (Solaris 8) danielsf SUN Solaris 2 01-08-2009 05:41 AM
Need to find only unique values for a given tag across the files sudheshnaiyer UNIX for Dummies Questions & Answers 8 09-03-2007 01:53 AM
How to Find AIX system parameters R00tSc0rpi0n UNIX for Advanced & Expert Users 1 01-25-2007 01:56 AM
Is it possible to find parameters? J_ang Shell Programming and Scripting 2 06-23-2006 03:58 PM
Passing Parameters and getting values back from a c program to Shell script Rajeshsu High Level Programming 5 08-22-2005 04:12 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-02-2008
jjminkle jjminkle is offline
Registered User
  
 

Join Date: May 2008
Posts: 1
using a vaiable parameters and values to find and tar

This one took HOURS and HOURS of my life. Hopefully this post will save someone the same grief.

I am using "-regex" with "find" via a variable. If I echo the command that is constructed, it looks OK. When I paste the echoed text it to the command line it runs fine. But inside the script it generates an error. This led me to the work around which was to pipe the echoed text to bash.

here is the snippet from the script that matters (using GNU bash, version 3.2.33(1)-release (x86_64-redhat-linux-gnu) - Fedora 8):

echo find "$FOLDER" -type f $EXCLUDE
find "$FOLDER" -type f $EXCLUDE
echo find "$FOLDER" -type f $EXCLUDE | bash

here is the output from above 3 lines:

find etc -type f -not \( -regex '^etc/X11/.*' -o -regex '^etc/fonts/.*' \)
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]
etc/bla
etc/foo

My question is why does the command not work in the script when it works fine on the command line or when piped to bash?
  #2 (permalink)  
Old 05-02-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,315
Precede the name of the directory with a slash:
Code:
/etc
Regards
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0