LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   shell alias problem (https://www.linuxquestions.org/questions/linux-general-1/shell-alias-problem-573776/)

raowl 07-31-2007 05:00 PM

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...

pixellany 07-31-2007 05:35 PM

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

raowl 09-19-2007 10:39 AM

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.


All times are GMT -5. The time now is 03:02 PM.