I want to search thru many files if a sentence or a string exists and printout the lines where this is present by calling a script like :
loc "arg1 arg2 arg3 arg4"
where arg1 arg2 arg3 arg4 would be in fact the sentence separated with blanks...
In my loc script, I would have to count the number of arguments and store them as a sentence into one single variable i guess, like :
sentence=`arg1 arg2 arg3 arg4`
But, as arguments number is undefined, how can i insure this to work in any case ?
Thanks perderabo,
of course I already tried this but here is my concern :
in fact i'm using the following command :
egrep_source argument="-ni $1" where egrep_source is an embedded egrep working in a configuration management tool...
And, as you can see, the quotes are already present and mandatory for egrep_source to work.
The only way I found to solve this is entering the command :
loc arg1 "arg2 arg3 arg4"
with the following code :
egrep_source argument="-ni $1" | egrep $2
This works of course, but I don't really like it !
does not work or I don't know how to manage this !.....sorry ! :rolleyes:
egrep_source argument="-ni $@" gives me an empty output...
and using $# is tricky as I don't know how many arguments will be entered....
Do you mean using $# in a for loop ? How ?
I'm using sh and both are working
$# = number of args
#@ = all args together
my problem is : how to use them ?!
My tests are giving me wrong results !
I need to find my args as a sentence in the right order....
For instance > loc arg1 arg2 arg3 arg4
with $@ = arg1 arg2 arg3 arg4 which could be "hi how are you" sentence.
I don't know how to use $# as $@ does not work in Egrep_source due to the quotes...