Article 51WVV find command not working in script but works fine from command prompt

find command not working in script but works fine from command prompt

by
unixhelp20201
from LinuxQuestions.org on (#51WVV)
I have a script where I am trying to find files for a specific time frame which I can grep for a specific text, script works fine from command line but not from script.

Check_Start_Date=`TZ=GMT+24 date +%Y-%m-%d`
Check_Stop_Date=`date +%Y-%m-%d`
Check_Start_Time="22:55:00"
Check_Stop_Time="07:00:00"

export Check_Start_Date
export Check_Stop_Date
export Check_Start_Time
export Check_Stop_Time

grep -i "Job ended with failure" find '/usage1/prlocal/oper/var/dbl/log/' -type f -newermt "${Check_Start_Date} ${Check_Start_Time}" \! -newermt "${Check_Stop_Date} ${Check_Stop_Time}"` | awk -F _ '{print $1}' >Jobs_Failed_${Check_Start_Date}.tmp1

when run from script it gives the below error:
: not found [No such file or directory]
: not found [No such file or directory]
: not found [No such file or directory]
: is not an identifierOME_DIRlatest?d=yIl2AUoC8zA latest?i=aZdw3uqso-k:wJl2eXps338:F7zBnMy latest?i=aZdw3uqso-k:wJl2eXps338:V_sGLiP latest?d=qj6IDK7rITs latest?i=aZdw3uqso-k:wJl2eXps338:gIN9vFwaZdw3uqso-k
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments