Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 07-31-2007, 05:00 PM   #1
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, 05:35 PM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
What is this supposed to do?
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, 10:39 AM   #3
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.

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



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 03:56 PM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
Delay in shell script or alias jeopardyracing Linux - Newbie 6 09-21-2004 08:07 PM
alias in bash shell wincrk Linux - General 12 07-20-2004 12:35 PM
RH9, alias and tcsh shell jeguilloal Red Hat 1 11-26-2003 01:42 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:55 AM.

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