grep inside if condition - need help

hi i need help with below code.

if [[ `grep "Error - The script has to be run first" ${LOCAL_DIR}/ar_${DATE}_${ID}.txt` ]]
                        then
log "Exiting the script as ID= NULL"
log "Please run script first."
fi

i am calling grep inside this but its not running any ideas why ??

input file is like this --

 
Msg 102, Level 20, State 1:
Server 'VA_DS', Line 12:
Incorrect syntax near 'Error - The script has to be run first'.

need help urgently

Works fine on my end

cat file.sh
if [[ `grep "Error - The script has to be run first" file.txt` ]]
                        then
echo "Exiting the script as ID= NULL"
echo "Please run script first."
fi
s:/tmp # sh file.s
file.s: file.s: No such file or directory
s:/tmp # sh file.sh
Exiting the script as ID= NULL
Please run script first.

Can't see any error either. Maybe post or describe your error.

Regarding:

Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.

Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.

If you have posted a question in the regular forum with a subject "Urgent" "Emergency" or similar idea, we will, more-than-likely, close your thread and post this reply, redirecting you to the proper forum.

Of course, you can always post a descriptive subject text, remove words like "Urgent" etc. (from your subject and post) and post in the regular forums at any time.

Thank you.

The UNIX and Linux Forums

I am extremely sorry for posting something with need urgent help. it will not happen again.

@3junior i dont know why it doesnt work for me

i m getting the below error :-

./Script.ksh[30]: syntax error at line 274 : `]]' unexpected

and i m using this code:-

if [[ `grep "Error - The script has to be run first" ${LOCAL_DIR}/bor_${DATE _${ID}.txt` ]]
then
echo "exiting the script as id= null"
echo "please run script 1s"
fi

any ideas i have already. put the error..

 
 
${LOCAL_DIR}/bor_${DATE _${ID}.txt

There is a space after ${DATE.