Another Find Problem

HI All,
I am having a bit of trouble using the find command in my shell (korn) script.
I was hoping someone could help me.

I am trying to build up a dynamic find command based on some parameters.

When I execute the command I get the following error:
find: incomplete statement

I have attached a stripped down version of the code which has the problem.

Any help would be apprecieated.
Thanks

if [ -n "$opt_file" ]
then
cat_str='\| nice -n 15 cat > '${opt_file}
else
cat_str='\| more'
fi

if [ -n "$opt_operator" ]
then
grep_str='\|nice -n 15 grep '${grep_str}

fi

if [ "$opt_enddate" -eq "$opt_startdate" ]
then
theExecStr="nice -n 15 find . -name \*.gz -exec nice -n 15 gunzip -c {} \; ${grep_str}${cat_str}"

    $theExecStr

fi

Try executing the command through "eval":

if [ "$opt_enddate" -eq "$opt_startdate" ]
then
theExecStr="nice -n 15 find . -name \*.gz -exec nice -n 15 gunzip -c {} \; ${grep_str}${cat_str}"

eval $theExecStr
fi

Nope, not luck with that :frowning: . I get a different error though. It now says:
find: missing conjunction

Thanks for the suggestion, any other ideas? Anybody?

Cheers

How about:
if [ -n "$opt_file" ]
then
cat_str='| nice -n 15 cat > '${opt_file}
else
cat_str='| more'
fi

if [ -n "$opt_operator" ]
then
grep_str='\|nice -n 15 grep '${grep_str}

fi

if [ "$opt_enddate" -eq "$opt_startdate" ]
then
theExecStr="nice -n 15 find . -name \*.gz -exec nice -n 15 gunzip -c {} \; ${grep_str}${cat_str}"

eval $theExecStr
fi

Nup, same missing conjunction problem.

Should I mention I am using Digital UNIX V4.0F (Rev. 1229) :confused:

ANy idea on this one prople? I would reall appreciate any help

Please follow the rules which state:
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post where your goal is to get an answer more quickly.