LinuxQuestions.org
Review your favorite Linux distribution.
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 07-31-2007, 06:00 PM   #1
raowl
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
shell alias problem


alias searchit='find . ! -regex ".*\(svn\|gif\|jpg\|png\|svg\|ai\)$" -type f -exec grep -snH $1 {} \;'

after i execute with parameter it gets me:
find: paths must precede expression
Usage: find [path...] [expression]

i tried putting -name "*", or in the path ".", but nothing...
 
Old 07-31-2007, 06:35 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
What is this supposed to do?
Quote:
find . !
In man find, the only reference to "!" that I could find was in conjunction with Options -H, -L, or -P
 
Old 09-19-2007, 11:39 AM   #3
raowl
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Original Poster
Rep: Reputation: 0
the other has some problems, this one:
if i run $find '.' \( -type f -a ! -iregex ".*\(svn\|gif\|jpg\|png\|svg\|ai\).*" \) -name "*" -print -exec grep -snH "stringTosearch" {} \;

works ok without a problem, but i want it like an alias, so i do this:

alias findthis='find '.' \( -type f -a ! -iregex ".*\(svn\|gif\|jpg\|png\|svg\|ai\).*" \) -name "*" -print -exec grep -snH "$1" {} \;'

the alias is setted fine, but when i do an $finthis stringTosearch or "stringTosearch"... whatever, i receive this message:

find: paths must precede expression
Usage: find [path...] [expression]

i have tried $1 alone, "$1", "${1}", and in the path . '.'(like this one) ".". \., i think that i added also that -name * that seems isnt needed , whatever but nothing... if someone have some problem like this or find some reasonable explanation please post.

pixellany
! is for not match... it has to be in that parentesis to work...

thanks.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
alias with cd in shell mtdew3q Linux - Newbie 6 05-11-2006 04:56 PM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 03:34 PM
Delay in shell script or alias jeopardyracing Linux - Newbie 6 09-21-2004 09:07 PM
alias in bash shell wincrk Linux - General 12 07-20-2004 01:35 PM
RH9, alias and tcsh shell jeguilloal Red Hat 1 11-26-2003 02:42 PM


All times are GMT -5. The time now is 08:23 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration